Solved

DSN Less Connection to a access database

Posted on 2002-07-18
3
132 Views
Last Modified: 2010-05-02
Hi

I have a access data base .I need to create a dsnless connection to it.Can anybody help
0
Comment
Question by:Vignette
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 7161706
ADO or DAO?

For ADO:

Dim myConn As ADODB.Connection
Set myConn = New ADODB.Connection
myConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\myfolder\mydatabase.mdb;Persist Security Info=False;"
myConn.Open
0
 

Author Comment

by:Vignette
ID: 7161749
One more question befor i give you the points.

How do you get a list of the tables in the access database
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 7161767
Simplest way is this with the above code:

Dim rstTables As ADODB.Recordset
Set rstTables = New ADODB.Recordset
rstTables = myConn.OpenSchema(adSchemaTables)

Then you can use the recordset and the various fields returned such as "CATALOG_NAME", "TABLE_NAME" etc to get the required information.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

739 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