how do i save lookup values in a form??

Muzicmn969

Registered User.
Local time
Today, 08:07
Joined
Apr 4, 2002
Messages
16
Heres the deal....

have 2 DBs, one is Airspace_definitions which has a field in it called Default_Altitude

the other is Airspace_events....

Now, i have a form which looks up the airspaceid as a combo box and default altitude from is referenced from DB1 as a text box

the concept works like a champ, whenever i select an airspace id, the altitude shows up in the field allocated for it. but it is not storing it in the events db...

so if i run a report on past activity the altitude is blank.


I am assuming that the db is showing the altitude information but not storing it in the field allocated for it. is there a way where i can have the form look up the altitude information based on which airspace is selected from the combo box and store that information in the events db???
 
If the altitude for a given airspace does not change, you do not need to store it in the events table (as you already have a reference to it in the Airspace definitions table) but only store the airspace ID in the events table.

You would then, in your query, add both tables to the query and add the fields you want to display, including the Default altitude from the definitions table.

If, however, these values can change, for istance if there is an event because the pilot was supposed to be in airspace ID 1 (altitude 36000 feet) but was actually cruising at 34000 feet then you would need to store that altitude as well as the allocated airspace ID in separate fields.

does this help?
 
in a way it does, but just want to verify......

most of the airspace has default altitudes, but on occasions they do change.....

so i wanted to lookup the default altitudes from one table and store it on the other table while also having the flexibility to overright the default altitude and store that if need be. in other words have the option of storing the default altitude or changing it and storing the new altitude

can that be done??? or do you think i need two seperate fields???
 
You will need two fields, one for the AirspaceID that they should have been using and an Altitude field in the events table.

You will need to bind the altitude textbox to the (new) Altitude field in the Events table and then set the value dynamically, depending on how you select the AirspaceID.
eg as you change the AirspaceID combo

Code:
Private Sub cboAirspace_AfterUpdate()
me.txtAltitude = me.cboAirspace.column(x)
end sub
where cboAirspace is your combo for selecting the airspace and txtAltitude is the textbox bound to the Altitude field in the Events table

This will 'plug in' the default value of the airspace but allow you to override this - hence storing the actual altitude in the events table whilst still maintaining the default altitude stored in the definitions table.
 

Users who are viewing this thread

Back
Top Bottom