Where to Put this Event

  • Thread starter Thread starter S Jackson
  • Start date Start date
S

S Jackson

I have a form with multiple pages. One [pgWitness], I have a subform called
[fsubSurveyors]. Within the subform there is a combo box drop down
containing a list of names. What I want the drop down to do is only show
the names that are related to a field [Region] on the first page of the
main form.

What I can't figure is what event to put the code under. If I put it on the
main form's OnCurrent, does that cover things when the user makes a change
to the [Region] field on the main form?

Could I put it on the tbCtl OnChange Event?

TIA
S. Jackson
 
It seems to me that the only time you would see a change in the drop down is
when the control is opened. So you can get away with putting the requery
code in the click event of the drop down (or maybe even the Got Focus event).


However, if changing the [Region] field requires (usually or sometimes) a
new selection in the drop down, then put the requery code in the After Update
of the [Region] field, set the drop down selection to null, pop up an OK
message box prompting the user to make a selection in the drop down field,
then when the OK is clicked set the focus to the drop down.
 
See comments in-line.

--
HTH
Van T. Dinh
MVP (Access)


S Jackson said:
I have a form with multiple pages. One [pgWitness], I have a subform called
[fsubSurveyors]. Within the subform there is a combo box drop down
containing a list of names. What I want the drop down to do is only show
the names that are related to a field [Region] on the first page of the
main form.
I assume the RowSource of the ComboBox is a parametrised Query with the
Field (Control?) [Region] as the Parameter.



What I can't figure is what event to put the code under. If I put it on the
main form's OnCurrent, does that cover things when the user makes a change
to the [Region] field on the main form?
No. Current won't work here as Current Event only fire when the Record
becomes current. It won't fire when the user edit the data in the Control.



Could I put it on the tbCtl OnChange Event?
Fine, Requery should work here. Alternatively, you can use the
ComboBox_GotFocus Event. Experiment and see which wany you prefer.
 
Back
Top