Charlotte Foust
cfoust at infostatsystems.com
Fri Mar 10 10:25:29 CST 2006
You aren't creating a connection object or specifying a provider, so you aren't going to get to first base the way you're going. That's why you're getting the error message, you haven't told ADO what provider/driver to use so it can look at the data source. Charlotte Foust -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bud Goss Sent: Friday, March 10, 2006 6:58 AM To: Access Group Subject: [AccessD] ADO recordsets and connection objects 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. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com