Solved

connect .mdb by ADO and ODBC

Posted on 1999-01-07
4
510 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

22 Experts available now in Live!

Get 1:1 Help Now