finding a record in a form?

  • Thread starter Thread starter Ross Crawford
  • Start date Start date
R

Ross Crawford

I'm new to Access, but not new to programming.

I have a form with a button that i want to use to find the first record
with null in a particular field. In the button's click code I put the
following code, basically pinched from the help file:

Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.Find "[Field] is null"
Me.Bookmark = rst.Bookmark

When I click the button, I get a "type mismatch" on the "Set" line. I
can't work out why this would happen, can anyone help me please?

ROSCO
 
The ADO and DAO libraries both have a Recordset type of object. The type
mismatch indicates you are getting the wrong type.

Try changing the first line to:
Dim rst As DAO.Recordset
If that causes an "unknown type" error, choose References from the Tools
menu, and check the box beside:
Microsoft DAO 3.6 Library

More info on which references you need for different versions of Access:
http://allenbrowne.com/ser-38.html
 
Allen said:
The ADO and DAO libraries both have a Recordset type of object. The type
mismatch indicates you are getting the wrong type.

Try changing the first line to:
Dim rst As DAO.Recordset
If that causes an "unknown type" error, choose References from the Tools
menu, and check the box beside:
Microsoft DAO 3.6 Library

More info on which references you need for different versions of Access:
http://allenbrowne.com/ser-38.html

Thanks Allen!
 
Back
Top