kirkm wrote:
Quote:
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. |
Based on what you wrote it sounds like you want the subform (frmUS) to
..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
this code.
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()
With Me!subfrmUS
.SetFocus
.Form.Requery
End With
End Sub
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()
requerySubForm
End Sub
and the main form's OnCurrent event might look like this:
Private Sub Form_OnCurrent()
requerySubForm
End Sub
--
'--------------------------
' John Mishefske
' UtterAccess Editor
' 2007 Microsoft Access MVP
'--------------------------