Labels/Combo Boxes affected by other combo boxes (1 Viewer)

Jordan76

Registered User.
Local time
Today, 11:27
Joined
Dec 26, 2002
Messages
49
First of all Thank you Jon K for replying so quickly to my last post,

Here's is my new question:)

I have a combo box that the user will select which airport they want to go to. Above it I have a label that says Description:

What I want it to do, is Say : Description: <airport name>

Depending on what the user chooses in the combo box? Is this possible? What type of method should I use? iif statement? It can be 1 of 55 choices so typing the iif statement would be bad, but im not to sure where to put it. Please let me know:)

Another Question along the same lines is:

How can I code 1 Combo Box to list the Hotels based on the State of the airport:

The combo box for airport Displays: Name, Airport Code, State
Under it, you have the combo box which lists Hotels, I want to make it so the hotels filter by state in the airport combo box, is this possible?

IF anyone could lead me along the right path it would be appreciated thanks, maybe you know of a post where someone asked this already,

Sincerely
JordaN
 

pottera

Registered User.
Local time
Today, 20:27
Joined
Sep 3, 2002
Messages
236
Jordan, try something like this-

In the query for your Hotel combo box, add the following to the criteria field for State

Forms!YourFormName!AirportComboBoxName.Column(2)

(assuming State is the third column of the Airport Combo box - this will filter Hotels in the same state)


In the OnClick event for your Hotel combo box-


AirportComboBoxName.Caption = "Description: " & AirportComboBoxName.Column(0)
HotelComboBoxName.Requery


Should do the trick.
 

Jack Cowley

Registered User.
Local time
Today, 11:27
Joined
Aug 7, 2000
Messages
2,639
For your first question use code like this in the After Update event of the Combo box:

Me.YouLabelName.Caption = "Description: " & Me.ComboBoxName

This article should answer your second question.

hth,
Jack
 

Jordan76

Registered User.
Local time
Today, 11:27
Joined
Dec 26, 2002
Messages
49
Thanks!

Got the Description working perfectly, Working on the multiple combo boxes now.

Thank you All.

Sicnerely,
Jordan
 

Jordan76

Registered User.
Local time
Today, 11:27
Joined
Dec 26, 2002
Messages
49
Problem

Forms!FrmInvoice!cboAirport.Column(2)


When I add that to Criteria I get an undefined function error, this is when I put it into the hotel query, Still working on it though.

Thanks Again
 
R

Rich

Guest
Add an unbound hidden text box to the form, set its control source to =[cboAirport].Column(2) set the criteria to reference the textbox and not the combo
 

Jordan76

Registered User.
Local time
Today, 11:27
Joined
Dec 26, 2002
Messages
49
Thanks So Much!

That did it! Now the only thing i need, is where do I put the cboHotels.Requery so it will requery every time they change the cboAirport combo?

Do I put it in the hidden box AfterUpdate?

This is the last thing I need for this form I hope, Thanks again for all the help.

Sincerely,
Jordan
 
Last edited:

Jordan76

Registered User.
Local time
Today, 11:27
Joined
Dec 26, 2002
Messages
49
Ok So here goes,

The combo Box works using the hidden field as the Criteria, However I need cboHotels to requery every time a change is made cboAirports (Hence the Hidden field should change). I can't seem to get the correct syntax or even to requery so it will change everytime, Thanks In advance you've all been a fantastic help.

Sincerely,
Jordan
 
R

Rich

Guest
On the After Update event of the combo either Me.Requery or MyFormName.Requery
 

Users who are viewing this thread

Top Bottom