I am experimenting with the reocrd set concept in VBA and have been trying to run the following code:
Private Sub Command0_Click()
Dim db As Database
Dim rs As Recordset
Dim intCount As Integer
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblInvoices"
intCount = rs.RecordCount
MsgBox "There are " & intCount & " records in the table"
rs.Close
End Sub
It fails in a runtime error 13, type mismatch every time and the debuger highlights the [Set set rs = db.Open etc.] line.
I have no clue what's wrong. Any ideas?
Private Sub Command0_Click()
Dim db As Database
Dim rs As Recordset
Dim intCount As Integer
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblInvoices"
intCount = rs.RecordCount
MsgBox "There are " & intCount & " records in the table"
rs.Close
End Sub
It fails in a runtime error 13, type mismatch every time and the debuger highlights the [Set set rs = db.Open etc.] line.
I have no clue what's wrong. Any ideas?