Recordset problems

  • Thread starter Thread starter Kurt Monroe
  • Start date Start date
K

Kurt Monroe

I'm new to VBA. I'm trying to open a recordset on a
table, but I get the error "object required" when I run
the code below. The error happens when it executes
the "Set rsCategories..." line.

What am I missing?

Thanks, Kurt


Private Sub Bttn_test_Click()

Dim rsCategories As Recordset
Dim strsql As String

strsql = "Select * from Categories"

Set rsCategories = dbs.OpenRecordset(strsql,
dbOpenSnapshot, dbSQLPassThrough, dbReadOnly)

End Sub
 
Kurt,

You are very close.

Dim dbs as DAO.Database
Dim rst as DAO.Recordset
Dim strSQL as string

strSQL = "Select * from Categories
Set dbs = CurrentDB
Set rst = dbs.openrecordset(strsql)


I realize you're trying to get a forward only, read only
recordset, but I've never used the PassThrough argument.
Try it with no arguments and see how it works.
 
Back
Top