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

Dynamically Switching Between Record Sets

Status
Not open for further replies.

f5snopro

Technical User
Feb 6, 2003
23
US
I have a form (frm_Main_Form) which can be called up one of two ways, either by imputting a value into a form (frm_By_ITMS_Number) for the ITMS number or by Selecting the person on a separate form (frm_choose_user). Both should call up (frm_Main_Form). Each have corresponding, predefined queries (qry_By_ITMS_Number) and (qry_By_PTG_Contact) the fields pulled are identical in each with the exception of the criteria. How can I get this form to pull based on which form the request came from? Would a SQL statement be better?
 
If you don't need to open the form in dialog mode, you can do this:

On the forms that open the second form, add one of the following lines of code immediately after the line of code that opens the form.

Forms!frm_Main_Form.RecordSource = "qry_By_ITMS_Number"
Forms!frm_Main_Form.RecordSource = "qry_By_PTG_Contact"

if you do need to open the form in dialog mode, then you can try setting a global variable prior to opening the form and then in the second form's onload event, evaluate the variable and set its own recordsource

me.RecordSource = "qry_By_ITMS_Number"
or
me.RecordSource = "qry_By_PTG_Contact"

if you use this method, you may need to requery the form.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top