Find a value on a subform based on a value entered on a main form ...

  • Thread starter Thread starter Joe Best
  • Start date Start date
J

Joe Best

I have a main form with a text box (Name is "nNCRID"). The main form
contains a subform (Name is "frmSub", Source Object is "frmBrowseNCRTable").
The subform contain fields NCRID, ReportedBy and NCManager.

What i would like to do is enter a number into the nNCRID field in the main
form and then return the record where nNCRID equals the NCRID field in the
subform.

Can anyone please help.

Many thanks,

Joe.
 
1. Create a "Select Query" to be the "Data Source" of
your sub form. Against the relevent Field in the Query,
insert the Criteria Like Forms![MainForm]![nNCRID]. Save
and close the Query.
2. For the Sub Form, set the Data Source to the Query you
have just created.
3. Create a Module "PublicVariables", then declare a
public variable (Public ChangeDetected As Boolean) in the
Module. Save and close the Module.
2. For the nNCRID field on the Main Form: -
For the "On Change" Procedure, add the Code
ChangeDetected=True.
For the "On Exit" Procedure, add the following Code: -

If ChangeDetected=False Then Exit Sub
ChangeDetected=False
me.frmSub.Requery

HTH


Tony C.
 
Back
Top