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!

recordset and subform 1

Status
Not open for further replies.

andzejek

MIS
Sep 1, 2007
154
US
How to refer recodset of the form when you process action on/of the subform

Andrew
 
Post the code where you are getting the error.
 
Private Sub part_num_Click()
Dim strSQL As String
Dim strWhere As String
Dim i As Integer
i = 0
strSQL = "part_num = '" & Forms![frm_invt_main]![invt_main subform3].Form![part_num] & "'"


rs.MoveFirst
rs.Find (strSQL)
rs.FindFirst strSQL


any reference to rs here is triggering an errormessage. This code is in OnCilck event of "part_num" field of the subform of the main form: "frm_invt_main"

Andrew
 
What is (or should be) rs for you ?

Tip: use the Option Explicit instruction.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thats because the Recordset is a public variable on the main form, and you are referencing it on the subform. A form level public variable is only visible within the form.

You could dimension the RS in a standard module making it global to the application. Or I think you can use the class name of the form. Something like
Form_MainForm.RS.Find(...)

 
I even think you could reference it as
me.parent.rs

since rs is a public variable of a class module and me.parent returns the form class. I did not try it, but I would think it would work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top