Getting At the Recordset Data

G

Guest

The following code comes from McFedries 2007 office System
Notes: I have created the Reference to Data Objects 2.8
Access Driver(*.mdb, *.accdb)
Data Source: Northwind Data Base via its location
------------------------------------------------------------------------
Code as follows:
'
'Sub RecordsetOpenSELECT() ' Opening a recordset Object using
'A Select Statement
'
'Dim Recordset,String
'
Dim rs As ADODB.Recordset
Dim strSelect As String
'
'Create a recordset Object
'
Set rs = CreateObject("ADODB.Recordset")
'
'Open It
'
strSelect = "SELECT * From Customers" & "WHERE [State/Province]='CA'" &
"ORDER BY Company;"
rs.Open strSelect, "Northwind", adOpenKeyset ( Message at this line)
(States Object Database doesn't support this statement) any ideas why?
'
'Display the contact Name and Company for the first record
'
MsgBox "The " & rs.Source & " table is now open!"
'
'Close it
'
rs.Close
Set rs = Nothing
'
Thanks for taking the time to review this
 
G

Guest

Are you connecting directly to Northwind database? There's no connection.

Try something like

dim conn as currentproject.connection

then alter this line to:

rs.Open strSelect, conn, adOpenKeyset

Also change the rs to

dim rs as adodb.recordset

set rs =new adodb.recordset

hth
 
G

Guest

Thank you ; when I get home from work this evening I'll try changing the code
and see what happens.
--
William<"M"




Maurice said:
Are you connecting directly to Northwind database? There's no connection.

Try something like

dim conn as currentproject.connection

then alter this line to:

rs.Open strSelect, conn, adOpenKeyset

Also change the rs to

dim rs as adodb.recordset

set rs =new adodb.recordset

hth
--
Maurice Ausum


Sunday88310 said:
The following code comes from McFedries 2007 office System
Notes: I have created the Reference to Data Objects 2.8
Access Driver(*.mdb, *.accdb)
Data Source: Northwind Data Base via its location
------------------------------------------------------------------------
Code as follows:
'
'Sub RecordsetOpenSELECT() ' Opening a recordset Object using
'A Select Statement
'
'Dim Recordset,String
'
Dim rs As ADODB.Recordset
Dim strSelect As String
'
'Create a recordset Object
'
Set rs = CreateObject("ADODB.Recordset")
'
'Open It
'
strSelect = "SELECT * From Customers" & "WHERE [State/Province]='CA'" &
"ORDER BY Company;"
rs.Open strSelect, "Northwind", adOpenKeyset ( Message at this line)
(States Object Database doesn't support this statement) any ideas why?
'
'Display the contact Name and Company for the first record
'
MsgBox "The " & rs.Source & " table is now open!"
'
'Close it
'
rs.Close
Set rs = Nothing
'
Thanks for taking the time to review this
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top