finding a record in a form?

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
 
A

Allen Browne

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
 
R

Ross Crawford

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top