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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open connection to ODBC

Status
Not open for further replies.

emikoo

Technical User
Jul 12, 2002
37
0
0
NL
Hi,

I use the DoCmd.Openquery code to run a query via a form/button. The query retrieves data from tables linked through ODBC. To access the data you need to answer a login/password. I would like to take the network user (NT), check whether he is entitled to access the data, if so, open the database connetion, run the query and then close the connection.

What code is required to get the NT user and open the connection to the table?

thnxs in advance,

Emile
 
For Standard Security:

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;" & _
"Uid=admin;" & _
"Pwd="

With a Workgroup (System database):

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;" & _
"SystemDB=c:\somepath\mydb.mdw;", _
"myUsername", "myPassword"

MDB exclusively:

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;" & _
"Exclusive=1;" & _
"Uid=admin;" & _
"Pwd="

For a Network Share:

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\\myServer\myShare\myPath\myDb.mdb;" & _
"Uid=admin;" & _
"Pwd="

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top