Ok, I'm back with another question. Just so everyone knows I'm trying to save money by designing my own database instead of having a "pro" come in and do it.
I have a Table and a Form called Flight Tracking.
The fields are: Airline, Flight Number, Arrival/Departure, Scheduled Time, Actual Time.
OK, here's what I want to do:
When the user opens the Flight tracking form they have to select an airline. Right now when you select an airline you have to manually go to every field to input the info, i.e. Flight number, arr/dep etc.
How do I set the form up to when a particular airline is selected only those flight numbers that correspond to that airline show up in the drop down list for flight numbers? OK, I want to add more to this. After those flight numbers are displayed when you select a particular flight number it automatically selects whether it is an arrival or departure and also automatically selects the scheduled time for that flight number.
If you're going to try to build the application that I think you might be trying to build, well then you may find that you will have quite a lot on your hands! Have you looked for a similar application available "off-the-shelf"??
The short answer is that your combo box row source needs to have criteria that includes the selected airline, then needs to be requeried when the airline changes, and when the form Current event occurs.
An easy way to do this is to create a function in a module that sets the value of the rowsource property for the combo box. Pass the function the airline ID, and return a string that is the rowsource for the combo box.
function MyFunction(intAirlineID as integer) as string
MyFunction = "Select MyField1, MyField2 from MyTable where AirlineID = " & intAirlineID & ";"
Now you can call this function from the form AirlineID afterupdate event procedure, and from the form OnCurrent event procedure.