I have been trying to connect to a datagrid using the following code:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim results As String
'Open Connection
Set cn = New ADODB.Connection
cn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\vendor1.mdb"
cn.Open
'Open Recordset
Set rs = New ADODB.Recordset
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
sSQL = "Select * from Vendor"
If g_sec <> "" Then sSQL = sSQL & " Where SectionID ='" & g_sec & "'"
rs.Source = sSQL
rs.ActiveConnection = cn
rs.Open
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
All of the code is pretty generic, running out of a new form. At runtime I get "Run-time error '7004' the rowset is not bookmarkable" ???? Any Ideas
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim results As String
'Open Connection
Set cn = New ADODB.Connection
cn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\vendor1.mdb"
cn.Open
'Open Recordset
Set rs = New ADODB.Recordset
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
sSQL = "Select * from Vendor"
If g_sec <> "" Then sSQL = sSQL & " Where SectionID ='" & g_sec & "'"
rs.Source = sSQL
rs.ActiveConnection = cn
rs.Open
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
All of the code is pretty generic, running out of a new form. At runtime I get "Run-time error '7004' the rowset is not bookmarkable" ???? Any Ideas