If one value then another value from same line

  • Thread starter Thread starter ant1983
  • Start date Start date
A

ant1983

Hi,

I've actually posted a similar question but still cannot resolve... Please
help!

What i want to do is when i select a value from a drop down list in a form
another text box needs to be populated with a value from the same line...

Er... Am i making sense? An example...

I have a form called tblBooking that runs off a table called tblBooking. In
this table i have the following fields; autBookingID, txtCompanyName,
txtBookedBy, txtContactNumber.

This form is used to capture bookings for transfers.

Then i have a table called autContactID, txtCompanyName (linked to above
table), txtContactName, txtContactNumber and txtContactEmail.

This table is all the contacts at the companies that make the bookings.

Riiiiight, on the frmBooking you select your company and then select the
contact name from a drop down box. What i want to achieve is to get the
txtContactNumber populated with that persons contact details...

Hope that was suffiecient info...

Thanks in advance!!!
 
Remembering that the index here is zero -based

Private Sub YourDropDownBox_AfterUpdate()
Me.Field1 = Me.YourDropDownBox.Column(0).Value
Me.Field2 = Me.YourDropDownBox.Column(1).Value
Me.Field3 = Me.YourDropDownBox.Column(2).Value
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
So are you saying it should look like this:

Private Sub txtBookedBy_AfterUpdate()
Me.txtContactNumber= Me.txtBookedBy.Column(0).Value
End Sub

txtContactNumber is the field i want to be looked up and then populated

Or like this:

Private Sub txtBookedBy_AfterUpdate()
Me.txtContactNumber= Me.txtBookedBy.txtContactNumber(0).Value
End Sub

txtContactNumber is the field i want to be looked up and then populated AND
it is also the field's name in the table that it goes and looks up from
 
Back
Top