Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box queries? 1

Status
Not open for further replies.

Xenos132

Technical User
Dec 12, 2004
43
CA
I have customers that have many locations. On my order form ( joined to my order table) I have 2 combo boxes. One is customer and the other is the location. After selecting my customer I would like to run a query so that the only options I have in my location combo box is the locations that belong to my customers.

Can some one lend a tip or 2 ?



 
How are ya Xenos132 . . . . .

As far as the combos are concerned, [blue]post the table structure[/blue] (quote & include fields involved in relationships, along with data types).

Calvin.gif
See Ya! . . . . . .
 
I am almost there. I am using a query for the second combo box all works fine if I hit F9 after updating the first combo box. I have tried “Me.Requery” in the afterupdate field and this works the first time, if I make and error I have to hit F9 again.

 
OK Xenos132 . . . . . .

Good going, just where I was headed. Your requey is the right idea, you have to [blue]requery the combobox[/blue] . . . . [blue]not the form[/blue].

So in the AfterUpdate of combo1 try:
Code:
[blue]Me!Combobox2Name.Requery[/blue]
and you should be home free!

Calvin.gif
See Ya! . . . . . .
 
You’re the man! One last question if I may. I am storing my primary Key value in my table not the name of the location. Is there a way that I can see the name after I select it? I used the wizard for my first combo box and it’s stores the Primary key but displays the customer name.
 
Xenos132 . . . . .

Lets see if I can paint this picuure with an example:

We have a combobox with 3 fields. From left to right in the list they are [blue]ID[/blue], [blue]Name[/blue] & [blue]Num[/blue]. There in this order because this is how the [blue]RowSource[/blue] query returns them . . . . . Now:
[ol][li][purple]Column Count[/purple] property: not what columns to show but how many![/li]
[li][purple]Bound Column[/purple] property: which column to store if the combobox is bound to a field. From left to right the value is an integer starting at 1.[/li]
[li]Column Widths property: from left to right, the widths of the columns. A width of zero hides a column, [purple]although it can still be accessed![/purple]

Now for what I think your looking for: [blue]the first non-zero column width from the left is whats displayed in the textbox portion of the combobox![/blue][/li][/ol]
This is how you can store one value yet display another . . .

Column Widths 0";1";1"
Displays Name, Num

Column Widths 1";0";1"
Displays ID, Num

Column Widths 1";1";0"
Displays ID, Name

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top