Connecting Tech Pros Worldwide Forums | Help | Site Map

Connect using file DSN in code using a DAO function

kathyk
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi All,
I am using Access 2003. I have a function that I have been using to log
on to linked tables using the system ODBC and it has been working great.
Now I want to do the same thing using a file dsn that connect to a
database using windows integrated security and I can't seem to get the
syntax right.

This is the only DAO code I use any more, is there an ADO equivalent?

Please take a look at this tell me what's wrong, or suggest a better
function!

Thanks!
Kathy

Function OpenConnectionX()

'Sets connection to ODBC datasource defined by DSN DV1.dsn
'Prevents the user from having to log into Db
'Requires DAO reference

Dim wrkJet As Workspace
Dim dbsSTL As Database

Set wrkJet = DBEngine.Workspaces(0)

Set dbsSTL = wrkJet.OpenDatabase("DV1.dsn", dbDriverNoPrompt, True, _
"ODBC;DATABASE=DV1;UID=myusername;PWD=;DSN = C:\Program Files\Common
Files\ODBC\Data Sources/DV1.dsn")

End Function


*** Sent via Developersdex http://www.developersdex.com ***

pietlinden@hotmail.com
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Connect using file DSN in code using a DAO function


first stop should be Carl Prothman's website. He has connection
strings for just about everything. I think it's now
www.carlprothman.com

kathyk
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Connect using file DSN in code using a DAO function


Thanks! That's a great resource. I also learned that I don't need this
function at all with a file DSN! It is embedded in the file.

Thanks again for your reply,
Kathy



*** Sent via Developersdex http://www.developersdex.com ***
Closed Thread