Combo box/Query Help

  • Thread starter Thread starter setterst
  • Start date Start date
S

setterst

I am still new to Access and querying, so please be gentle.

I am creating a form in Access where I am using a series of combo boxes
to create a product selector. The problem I am running into, is I want
to be able to change the Field of next combo box's query based on a
previous selection. Can anyone lead me in the right direction on this?

For example, somehting that would have this effect:

SELECT DISTINCT Table.([Forms]![SelectorForm]![ComboBoxSelection])
FROM Table;

I want to be able to use the results for the source of the next combo
box, so if anyone has any suggestions involving something other than
correcting my syntax to the query, I am listening.

Thanks!!
 
Your post said
... so if anyone has any suggestions involving something other than
correcting my syntax to the query, I am listening.

so you probably don't want to hear that the syntax won't work as shown.
What's missing is how you tell Access to look in a table for rows where a
field matches what's found in the "specified" combo box.

For a generic treatment of the topic, look up "cascading combo boxes" in
Access HELP and in the newsgroups.

Good luck!

Jeff Boyce
<Office/Access MVP>
 
The information I was able to find only detailed the scenario where you
knew the column(s) you wanted to return. I would like to find a way to
change the column(s) I return based on previous form inputs (aka the
combo boxes).
 
Well, I think I figured out an easy way to do it. I wrote a vba script
that is attached to the On Got Focus property of the combo box. From
there I was able to just set a string equal to the value of the
previous combo box, then use that in building the SELECT statement, and
save that as the next combo box's Row Source.

Works beautifully!

Thanks for the help.
 

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

Back
Top