Problems using ADODB and adPromptNever
- From: cbender@xxxxxxxxxxxxxxx
- Date: Mon, 16 Jun 2008 10:15:34 -0700 (PDT)
Previously I wrote some code for an Access 2003 application to verify
on startup that it is correctly linked to SQL Server. Since it was
important that the driver not prompt the user and the rest of the
application uses DAO, I used the following code
Set wksp = DBEngine.CreateWorkspace("", "", "", dbUseODBCCursor)
Set db = wksp.OpenDatabase("", dbDriverNoPrompt, True, strTemp)
However Access 2007 does not support this method, so I rewrote the
code using ADODB as follows:
strTemp = "Provider=SQLOLEDB.1;Data Source=MyServer;Initial
Catalog=Database;Integrated Security=SSPI"
Set conn = CreateObject("ADODB.Connection")
'conn.Properties("Prompt") = 4
conn.Open strTemp
The code runs fine as long as I don't attempt to set the property for
prompt to the value for adPromptNever (4). (I'm using late binding
because the rest to the application uses DAO). But as soon as I
attempt to set the property I get an error message "Object invalid or
no longer set"
Anyone have any thoughts on this? 99% of the time it would not be an
issue since the application will be correctly link, but if on the
first startup after install it cannot find the SQL Server, I don't
want the default prompt to appear but want to handle the problem using
a custom form.
Thanks in advance
Cheryl
.
- Follow-Ups:
- Re: Problems using ADODB and adPromptNever
- From: Bob Barrows [MVP]
- Re: Problems using ADODB and adPromptNever
- Prev by Date: Re: Long Records Giving me Grief!
- Next by Date: Re: Problems using ADODB and adPromptNever
- Previous by thread: Re: Long Records Giving me Grief!
- Next by thread: Re: Problems using ADODB and adPromptNever
- Index(es):
Relevant Pages
|