Subform Question - 07-24-2007 , 01:18 AM
Wonder if someone can assist here, please?
I have a Form which I've dragged onto another Form
to have several things on the Form at once.
I've called this 'subfrmUS'. And set it's Source Object to frmUS.
frmUS has it's record source set to Query1
A selection is made from a combo box and resultant sql built which is
assigned to Query1.
My aim is to have subfrmUS display query1.
Both Query1 and frmUS display the right thing.
However nothing will make subfrmUS show query1 - except once when the
Form is first opened.
I've spend hours with 'Requery' but that doesn't seem to work.
Thanks - Kirk
Re: Subform Question - 07-25-2007 , 07:13 PM
..Requery the databases after the user has updated the value of a combo
box on the main form.
Here is what I would do and it sounds that this approach may be what
you've tried. Perhaps my example will help determine the problem.
You want all this to happen after the combo box on the main form is
updated so that control's AfterUpdate event is the appropriate to place
You state the subform's displays correctly when the form is opened. What
if you navigate record's on the main form (if the main form is is bound
to a record source)? You may need to also requery on the main form's
OnCurrent event. Assuming you may need to run the same code from two (or
more) different events I wrote a procedure (a Sub):
Private Sub requerySubForm()
Put this code in the code behind your main form.
Now you can call this proc from the appropriate event, for example, if
you combobox is named cboMyCombo then its AfterUpdate event code might
look like this:
Private Sub cboMyCombo_AfterUpdate()
and the main form's OnCurrent event might look like this:
Private Sub Form_OnCurrent()
' John Mishefske
' UtterAccess Editor
' 2007 Microsoft Access MVP