?
Solved

connect .mdb by ADO and ODBC

Posted on 1999-01-07
4
Medium Priority
?
531 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
[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
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
jjbyers earned 180 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses

764 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