Home All Groups Group Topic Archive Search About

dns-less connection w/ no prompt

Author
20 Oct 2005 8:08 PM
stoppal
have a problem trying to link my access table using VB


I can connect using the below connection string ....


Driver={SQL
Server};SERVER=MYSERVER;UID=MYUSERNAME;PWD=myPASSWORD;DATABASE=myDATABASE;



WHEN I USE....


Set dbsODBC = OpenDatabase("",False, False, strConnect)


BUT IF I try to disable the prompt using....


Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)


AND


Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
strConnect)


my connection either does not connect or it displays the prompt. I
think the problem has something to do with me not using a DSN, but I
thought I should be able to connect without one.  PLEASE HELP!


What am I doing wrong, and why would this be happening?


THANK YOU!!

Author
20 Oct 2005 9:20 PM
Jeff Johnson [MVP: VB]
<stop***@hotmail.com> wrote in message
Show quoteHide quote
news:1129838887.085066.277980@g49g2000cwa.googlegroups.com...

> have a problem trying to link my access table using VB
>
>
> I can connect using the below connection string ....
>
>
> Driver={SQL
> Server};SERVER=MYSERVER;UID=MYUSERNAME;PWD=myPASSWORD;DATABASE=myDATABASE;
>
>
>
> WHEN I USE....
>
>
> Set dbsODBC = OpenDatabase("",False, False, strConnect)
>
>
> BUT IF I try to disable the prompt using....
>
>
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
>
>
> AND
>
>
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
> strConnect)
>
>
> my connection either does not connect or it displays the prompt. I
> think the problem has something to do with me not using a DSN, but I
> thought I should be able to connect without one.  PLEASE HELP!
>
>
> What am I doing wrong, and why would this be happening?

Here's a sample of opening from an Access database I have (it appears you're
using DAO, altough next time you have a question please specify that instead
of making us guess) so it should be similar. I'm not quite sure what you
meant by "link my access table," because it looks like you're simply trying
to open a connection to an SQL Server, not do any sort of linking (as Access
defines linking).

   Dim wks As DAO.Workspace, cnn As DAO.Connection

   Set wks = DBEngine.CreateWorkspace("MyODBCWks", "", "", dbUseODBC)
   Set cnn = wks.OpenConnection("", dbDriverNoPrompt, False,
"ODBC;DRIVER={SQL
Server};SERVER=MyServer;DATABASE=MyDB;Trusted_Connection=True;")

Of course, substitute your values (such as UID and PWD instead of
Trusted_Connection, etc.).

Oh, and now that I look at it, it could be the missing "ODBC;" from the
beginning of your connection string. Jet is picky....
Are all your drivers up to date? click for free checkup

Author
21 Oct 2005 2:04 AM
stoppal
thank you for the recommendation I'll try it at work tommorrow.

I'll tell you if it works friday, morning
Author
21 Oct 2005 2:57 PM
stoppal
THANK YOU, YOU SOLVED IT.
THANK YOU

Bookmark and Share