create ODBC DSN entry in code

I have a requirement where I need to create an ODBC DSN connection in VB code. I should also check to see if the system DSN entry exists first. I will be connecting to an Access database in my app.

Would anyone out here have a snippet of code on how to do this?

I would greatly appreciate it.

Thanks in advance.
LVL 13
Who is Participating?
CarlJWhiteConnect With a Mentor Commented:
try this link...

I havent used it but just remember downloading the source code
Why don't you open the connection DSN-less? A connection string for ADO is:

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
Éric MoreauSenior .Net ConsultantCommented:
samic400Author Commented:
thank you. Other comments good but this is exactly hat I was looking for.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.