Solved

DSN Less Connection to a access database

Posted on 2002-07-18
3
124 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
  • 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now