Reduce combo box selections

  • Thread starter benjaminkmartin
  • Start date
B

benjaminkmartin

I have two comboboxes where combo1 follows combo2. I want the coice
in combo1 to reduce the choices in combo2.

Choices in combo1 are Vehicle A and Vehicle B. Each is given an ID of
1 for Vehicle A and a 2 for Vehicle B
The table for combo2 has several different locations, which are
different for each vehicle. The table looks as follows.

Table1:
Vehicle_ID, Location, Location ID
1 LocA 01
1 LocB 02
2 LocA 01
2 LocC 03
2 LocD 04

As shown, some of the locations occur on both vehicles... Right now
combo2 has all the locations listed, but I only want the ones on that
particular vehicle to show up. How do I do that?

I found a code to be place in afterupdate of combo1 for a similar
question, but I couldn't get it to work for me.

(air code)
dim strSQL as string
strSQL = "Select whatever WHERE CompanyID = " & me!combo1
me!combo2.rowsource=strSQL

Thanks for the help, I really need it!
 
B

benjaminkmartin

Hi,

Here's the link that showed me how to do this:

http://www.mvps.org/access/forms/frm0028.htm

Simon

I keep running into trouble. I finally got one of the methods to work
partially, but it would only bring up one column of information. I
need two columns... Can anyone explain it to me a little better? I'm
still trying to figure this Access stuff out...

Thanks so much!
 
B

benjaminkmartin

From the link on the page above I think my best option is the second
of the two choices. I set up a form with three frileds, Vehicle ID,
Location Name, and Location ID. The combobox is getting filtered by
Vehicle ID, so I need the second two (location name, and ID) to show
up in the combobox.

I set up a parameter in the query that looks like this...

Location_Name, Location_Code from Location_ID Where Vehicle_ID = Forms!
Location_ID_and_Component_ID_Generator!Vehicle_ID

But I am given the error message of "Invalid bracketing of name".

What am I doing wrong?
 

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