Type Mismatch in DAO

  • Thread starter Thread starter David
  • Start date Start date
D

David

Can someone please tell me why I'm getting an Error 13 message:
"Type mismatch" at the 'Set rst = ... line, using this code (it works fine
in another .mdb file):

Dim dbs As Database
Dim rst As Recordset
Dim I As Integer
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * from NTDInvNum")
rst.MoveLast
invoice.Value = rst.Fields("InvNum").Value 'get last number
Debug.Print rst.Fields(0).Value
rst.AddNew
rst.Fields("InvNum").Value = invoice.Value + 1 'add to last number 1
rst.Update

rst.Close
dbs.Close

Thanks in advance
David
 
Is this an Access 2000 or newer version? If so, the default
is now ADO and you will need to explicitly declare a DAO
database and recordset and make sure that you have a
reference to DAO 3.6(?)

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

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Back
Top