How to trigger Query

G

Guest

On my form I have a combo box that I use to select names to display their
records in a subform just below the combo box. When the name is selected it
is supposed to trigger a query to pull up their record. If I select a name in
the combo box and then manually run the query it works ok. Its seems like I
need some type of code to add to the combo box that would run in the
"Afterupdate" field, but thats beyond my skills. Any ideas

The name of the combo box is "Combo10" and the name of the query is
"Q-Compt-Time"

Thanks
 
R

Rick Brandt

George said:
On my form I have a combo box that I use to select names to display
their records in a subform just below the combo box. When the name is
selected it is supposed to trigger a query to pull up their record.
If I select a name in the combo box and then manually run the query
it works ok. Its seems like I need some type of code to add to the
combo box that would run in the "Afterupdate" field, but thats beyond
my skills. Any ideas

The name of the combo box is "Combo10" and the name of the query is
"Q-Compt-Time"

Thanks

Me!SubformControlName.Requery

However; it looks to me like you could just set the MasterLink and ChildLink
properties on the subform control to do this with no code at all.
 
G

Guest

Please look at Allen Browne's website for instructions on how to use a combo
box and replace the cbomoveto with combo10 or the other way around. I have
used his instructions over and over again.
The main form's record source should be your query.
Using Allen Browne's sample to requery use:

Me.CustomerId.Requery
 
R

Rick Brandt

George said:
What is control Name - is that the name of the query I use ?

If you have nothing in your main form but a ComboBox and the only purpose of
the ComboBox is to control which records are displayed in the subform then
all you need to do is set the MasterLink property of the subform control to
the name of your ComboBox and set the ChildLink property to the field in the
subform's RecordSource that corresponds to the ComboBox.

Any time you change the ComboBox entry those property settings will
automatically synchronize the subform to display the matching records.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top