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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't pass a subform's recordset to a function

Status
Not open for further replies.

rewdee

Programmer
Aug 17, 2001
295
US
I would like to pass a recordset of a subform to a function that takes a recordset as a parameter like:
Code:
sub Cmd1_click
    if GotoData(Me.subform1.Form.Recordset) then
        msgbox "Yeah it works!"
    end if
end sub

private Function GotoData(rs as recordset) as boolean
    GotoData=True
end function

Whenever I try this I get a error number 13 Data Type mismatch. Can anyone tell me why and what I have to do to pass a subform's recordset to a function?

Thanks,
Rewdee
 
The answer is probably in these questions.
What kind of recordset are you working with? DAO, ADO

private Function GotoData(rs as DAO.recordset)
private Function GotoData(rs as ADODB.recordset)

What type of recordset does the subform default to?
What reference libraries do you have set? DAO, ADO, etc
 
You can also pass the whole subform to the function as a parm straignt from the subform.

varReturn = process_User_Request(Me) as the call statment. of varRetrun is dim as varient

process_User_Request(frm As Form), varient this being the function you are passing to, and the refer to all fields as me!fieldname.

Hope this helps
Trudye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top