Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help with Type Mismatch error!

Status
Not open for further replies.

dlstapleford

Programmer
Dec 11, 2002
14
0
0
US
This code is from a book but when I try to use it, I get a type mismatch error every time. I did call the function as described below. The error occurs on the line that says, "Set rstClone = frm.RecordsetClone"

Public Function DisableEnable(frm As Form)
'To call the function set the form's OnCurrent
'property to =DisableEnable(Form)

Dim rstClone As Recordset
'Create a clone of the form's recordset to
'move around in without affecting the form's
'recordset
Set rstClone = frm.RecordsetClone
 
Just checked the code and it works ok.

Are you entering the call directly in the OnCurrent Event box or as an EventProcedure?

It should be directly in the box and Access should reformat it to look as:

=DisableEnable([Form])

ie there should be square brackets around the word Form.

HTH

LeonH
 
I tried both ways. I did get it to work with an alteration but I don't know what the ramifications are.
I changed: "Dim rstClone As Recordset"
To: "Dim rstClone As Object"
Do you know why it works now and didn't then?

 
Try
Dim rstClone as DAO.Recordset

and see if that makes a difference.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top