Type Mismatch

  • Thread starter Thread starter Leonard
  • Start date Start date
L

Leonard

Can anyone tell me why I keep getting a "Run-time error
13... Type Mismatch" on the following code?

Any help appreciated.

'===========================================
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("MyQuery")

If rst.RecordCount >= 1 Then
MsgBox "At least one record has been entered"
End If
'===========================================
 
Both ADO and DAO have the Recordset Object and your rst is
defaulted to ADO Recordset while you need DAO Recordset.

Disambiguate your dec. like:

Dim dbs As Database
Dim rst as DAO.Recordset

HTH
Van T. Dinh
MVP (Access)
 
Back
Top