[AccessD] ADO recordsets and connection objects

Bud Goss bgoss711 at ameritech.net
Fri Mar 10 08:58:29 CST 2006


I am trying to learn the basics of ADO recordsets and connections.
  So far, I have been unable to get to first base. The two methods listed below give me the following error:
   
  
  Run-time error'-2147467259(80004005)
  [Microsoft][ODBC Driver Manager] Data source name not found and no
  default driver specified
   
  First attempt with udl file:
   
  Public Sub MyADOTest01()
  Dim rec As ADODB.Recordset
  Set rec = New ADODB.Recordset
  rec.Open "Select * from [Orders] ", "File Name = C:\B\A\x.udl"
  rec.CursorLocation = adUseClient
  rec.LockType = adlockBatchOptimistic
  MsgBox "OPEN HAS OCCURED " & rec!Customer
  End Sub
   
  Second attempt without udl file”
   
  Public Sub MyADOTest02()
  Dim rec As ADODB.Recordset
  Set rec = New ADODB.Recordset
  rec.Open "Select * from [Orders]", "File Name = C:\B\A\Northwind.mdb"
  rec.CursorLocation = adUseClient
  rec.LockType = adlockBatchOptimistic
  MsgBox "OPEN HAS OCCURED " & rec!Customer
  rec.activeconnection.Close
  End Sub
   
  C:\B\A\     
. Contains    x.udl   and  Northwind.mdb
  x.udl points to C:\B\A\Northwind.mdb and has MicrosoftJet 4.0 OLE Provider specified
   
  Subs are contained in another Access 2003 database that is located in C:\B\A_Access_Tr
   
  This database does have the  reference 
  Microsoft ActiveX data Objects 2.1 Llibrary
  
    
  Any help would be appreciated.



More information about the AccessD mailing list