Get default value from another table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

First time poster (have mercy:-)

Entering new records in a form for table TourDetail and I want to pick up
the MaxPax (maximum number of passengers) from table TourMaster. First thing
on the TourDetail form is a combo box for selecting the tour (from
TourMaster). Once this is done I want MaxPax from TourMaster to populate the
MaxPax field on the form, and then the operator can change the MaxPax or
leave it as is.

TIA,
Charlie
 
You can use the AfterUpdate event of the combo box to get the max value and
then put it in the textbox.

Something like this, perhaps:

Private Sub ComboBoxName_AfterUpdate()
Me.TextBoxName.Value = DLookup("MaxPax", "TourMaster", _
"TourID =" & Me.ComboBoxName.Value)
End Sub
 
Hi Charlie,

In the query for your unnamed tour selection combobox - I'll call it
cboTour - make sure that you return the tour name and the MaxPax value.
Then, in the AfterUpdate event of cboTour put in code something like this:
Me!MaxPax=Me!cboTour.column(1).

For what its worth, I'd get a copy of the Reddick naming convention and
follow it. You may already have it as an appendix in one of your 3rd party
Access books.

HTH
 
Thanks....it works fine

Ken Snell said:
You can use the AfterUpdate event of the combo box to get the max value and
then put it in the textbox.

Something like this, perhaps:

Private Sub ComboBoxName_AfterUpdate()
Me.TextBoxName.Value = DLookup("MaxPax", "TourMaster", _
"TourID =" & Me.ComboBoxName.Value)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top