Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Logon to SQL

Status
Not open for further replies.

jmount

Programmer
Oct 1, 2002
7
US
I have several tables linked to an SQL db using a file DSN. There will only be 5-6 people using this interface, and they all have one logon.

I would like to automatically log them on without a prompt and, although I know how to do this within the query by using the dbconnection string with an ODBConnection, I am not sure how to do it via code since I'm using a File DSN.

Any help would be greatly appreciated!

jem
 
Sub myLogin()

Dim db As Database
Set db = OpenDatabase("", False, False, "ODBC CONNECT STRING GOES HERE")

End Sub

Basically, you can cheat on the ODBC connection you need by creating a blank passthru query and click on the properties button in the menu bar. Then click on ODBC connect string and use the wizard (the ... button on the left of the field when you click in the box)and connect to the database that contains the tables. Choose to save the password and then copy and paste this information in the above code where it says ODBC CONNECT STRING GOES HERE. Be sure to enclose it in "".

Then execute this code when the database opens.



Trisha
padinka@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top