By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 2,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Connect using file DSN in code using a DAO function

P: n/a
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 ***
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


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

Nov 13 '05 #2

P: n/a
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 ***
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.