Triggering a Query

D

down in flames

I have set up a form with 3 cascading drop downs to select vehicle make,
vehicle model, and vehicle year. Each make/model/year combination was
assigned an autonumber value called VINmaster. I have the 3 drop downs
functioning correctly via afterevent, but now what I want to do is associate
the end-users selection to the VINmaster number then use that number to
display products associated with that vehicle. I assume this would be done
with queries, but I have 2 questions:

1) How can I associate what was selected in the combo-boxes to the VINmaster
key in tblVehicleInfo?

2) Then once this is achieved, can this be used to trigger multiple queries
for different products or should one query be able to display different
products in different areas on a form?

Thanks!
 
D

down in flames

Ok, I think I got question number one under control, I just changed the
Column count property to 2 and pulled VINMaster with the rowsource. Now I
just cant figure out how to use this number to display the related products.
 
R

Ron2006

Depending on how your forms are arranged:

1) Create a subform with parent/child (master/child) linkage pointing
to that field. Even if the wizard won't run for that linkage you can
type the field names in manually and it works just fine.

OR

2) Create a subform with a query that has criteria pointing to that
field and in the afterupdate event of the combo do a re-query of that
subform.

Ron
 
R

Ron2006

More considerations:

Prior suggestions will work IF the bound field is the VINMaster number
you talked about.

If it is NOT the bound field then create another txt box on your form
that is invisible and in the afterupdate event of the combo box
do me.hiddentxtboxname = me.comboname.column(1) and then do
either of the prior suggestions but point them to this
hiddentxtboxname instead of the comboboxname.

Ron
 
D

down in flames

Thanks for the reply- What I tried doing was creating the subform linked to a
query. What happens is that the data in the subform does not change but if I
go thru the drop downs then manually open the query it displays the correct
data (only in the query). I am obviously overlooking something in the
properties. Also, is it possible to get the subform to keep the design view
formatting and not display as a datasheet? While I was trying to figure out
what I was doing wrong, I tried using the dropdowns to display the results as
a report instead and it worked fine.
 
R

Ron2006

This part is easiest:

Also, is it possible to get the subform to keep the design view
formatting and not display as a datasheet?

In design view, go to the form properties
format tab
default view


and change it to single or continuous for it to show as you have it
designed. If it is set as datasheet it will look like a spreadsheet.



On the other problem, are you doing the following
me.subformname.requery in the afterupdate event of the dropdowns.

That is what is necessary if the parent/master child linkage is not
present.

The subform should be already open on the main form where you have the
combo boxes.

Ron
Ron
 
C

campos valdez

This part is easiest:

Also, is it possible to get the subform to keep the design view
formatting and not display as a datasheet?

In design view, go to the form properties
format tab
default view


and change it to single or continuous for it to show as you have it
designed. If it is set as datasheet it will look like a spreadsheet.



On the other problem, are you doing the following
me.subformname.requery in the afterupdate event of the dropdowns.

That is what is necessary if the parent/master child linkage is not
present.

The subform should be already open on the main form where you have the
combo boxes.

Ron
Ron
 

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