Solved

connect .mdb by ADO and ODBC

Posted on 1999-01-07
4
519 Views
Last Modified: 2013-11-23
I want to try ODBC and ADO.

Can you give me a step by step instruction showing how to connect a mdb file? (from get a refrence, if any, to create a recordset)

Thank you in advance.

Victor
0
Comment
Question by:victorlong
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
jjbyers earned 60 total points
ID: 1454602
Make sure you select Microsoft ActiveX Data Objects 2.0 Library from the References item under the Projects menu.


Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

  Set cn = New ADODB.Connection
  Set rs = New ADODB.Recordset
  cn.CursorLocation = adUseClient
  rs.CursorLocation = adUseClient
   
  cn.Provider = "Microsoft.Jet.OLEDB.3.51"
  cn.Open "C:\program files\devstudio\vb\nwind.mdb", "admin", ""
 
  rs.Open "Select * from customers", cn, adOpenStatic, adLockBatchOptimistic
 
  Set MSHFlexGrid1.Recordset = rs
 
  rs.Close
  Set rs = Nothing
  cn.Close
  Set cn = Nothing

Hope this helps.
0
 

Author Comment

by:victorlong
ID: 1454603
Hi jjbyers,

Can you tell me the file name for Microsoft ActiveX Data Objects 2.0? I just can not find it :-(

Victor
0
 
LVL 3

Expert Comment

by:jjbyers
ID: 1454604
You might have to install ADO on your box to see it under the References dialog box, under the Projects menu.

The name of the file is MSADO15.DLL.

On my box it's installed under c:\program files\common files\system\ado.
0
 

Author Comment

by:victorlong
ID: 1454605
Adjusted points to 60
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2 51
Saving history changes to sub form 4 37
Access 2013 combo box not working 3 38
FMX and jaudiotracker playing memory stream 29 67
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 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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

867 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

18 Experts available now in Live!

Get 1:1 Help Now