How to autopopulate an entry based on earlier entry?

sendtobrad

Registered User.
Local time
Today, 16:03
Joined
Nov 15, 2008
Messages
14
Access 2003. The n_number and m_tach fields are linked on an existing query. How can I make the m_tach field auto populate when user selects N_number. Thanks....
 
Not sure what you're really after, but I guess u want to populate a comboBox with data from m-tach, based upon criteria from n_number? Pls be more elaborate...
 
I have a form which requires N-number of an aircraft which is filled from a combo box with control source Aircraft, Rowsource qryTblAircraft. The query just list all available values for the field N_number. What I would like to do is auto fill another combo box which asks for M_tach. Each N_number has an associated M_tach (5-8 digits) number in the tblAircraft. I am sure since the information is already tied together in the table I should be able to autopopulate the M_tach field. I just don't know how.
 
Ok, now you're talking. How about:

Private Sub cboN_Number_AfterUpdate()
Me.cboM_Tach.RowSource = "SELECT M_tach FROM qryTblAircraft WHERE N_number =" & Me.cboN_Number & " ORDER BY m_tach;"
End Sub

This will populate combo cboM_Tach with all occurences of M_tach where N_number is the same as the one selected in cboN_Number. Now if there's always only 1 M_tach for a given N_number there is no need for a combo for M_tach, since there's only 1 option to be selcted from. Just a textbox would do, in that case. In this 1 on 1 scenario u might even add M_tach as a second column in the N_number combo, and will show up alongside the N_number (u have to adjust the combo properties of course: number of columns, column width etc.).

HTH
 

Users who are viewing this thread

Back
Top Bottom