Link to home
Start Free TrialLog in
Avatar of KimberleyY
KimberleyY

asked on

MSAccess SQL Pass through Promts for ODBC Connection

My SQL pass though query promts for the ODBC Connection each time it runs.  How do I stop that?
Avatar of Toast_Boy
Toast_Boy

It sounds like the reference to the DSN has been lost, try re-creating the query from scratch
What does the connection string in the query look like?
Avatar of KimberleyY

ASKER

jmoss111 -
There is no connection string in the query - from your question I take it I need one!  I am developing this at our office and taking it to a client.  Is there a way to refer to the ODBC Connection by name or do I need to buikdl the whole string?

Kim
PS I dont really thinl I am a guru - I just want to get through all those STUPID prompts and get to asking my question.
SOLUTION
Avatar of Toast_Boy
Toast_Boy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That type of behaviour occurs when you don't have the ODBC Connect Str populated in the Query Properties. Unless you enter values the default value is ODBC;

If you enter a connect string then you won't be prompted for connection info. What the ODBC Connect Str is looking for is something like :

ODBC;DRIVER={SQL SERVER};SERVER=999.999.999.999\SQLEXPRESS;DATABASE=EmailGlobal;UID=myUserName;PWD=xxxxx;ADDRESS=999.999.999.999:1433;

Where 999.999.999.000 = IP address; you can use the server name instead. The :1433 is the port to use.
Open the query in design view and right click on the query title bar and click prioperties to view the properties window.
What I exampled above was for mixed mode authentication, for windows authentication just substitute the PWD=xxxxx; with Trusted_Connection=Yes;

Either way you will have to build the connect string in code and grab the user name from Windows. Using the DSN-less connection you code it once or somebody has to create it on all users workstations.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Toast Boy and jmoss111.

jmoss111 - thanks for the tip and code  on gettting the user name. Into the string That would have been areal gotcha!

Excellent Job