Solved

create ODBC DSN entry in code

Posted on 2002-05-09
4
221 Views
Last Modified: 2010-05-02
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.
0
Comment
Question by:samic400
4 Comments
 

Accepted Solution

by:
CarlJWhite earned 85 total points
ID: 6999262
try this link...

http://www.thescarms.com/vbasic/CreateDSN.asp

I havent used it but just remember downloading the source code
0
 
LVL 15

Expert Comment

by:robbert
ID: 6999352
Why don't you open the connection DSN-less? A connection string for ADO is:

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;"
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6999484
0
 
LVL 13

Author Comment

by:samic400
ID: 7009192
thank you. Other comments good but this is exactly hat I was looking for.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question