Combo Box Values

S

SueW

Access 2007

How do I display a first and last name on the form from a combo box?

I would like the address, city, and home phone number to fill in the
appropriate fields on the form when selecting the name.
 
D

Douglas J. Steele

You refer to the combo box's Column collection in its AfterUpdate event.
Let's assume that the first name is in the second column, the last name is
in the third column, the address is in the fourth column, the city is in the
fifth column and the phone number is in the sixth column. You'd put their
values into text boxes using code like:

Private Sub cboSelection_AfterUpdate()

Me!txtFirstName = Me!cboSelection.Column(1)
Me!txtLastName = Me!cboSelection.Column(2)
Me!txtAddress = Me!cboSelection.Column(3)
Me!txtCity = Me!cboSelection.Column(4)
Me!txtHomePhone = Me!cboSelection.Column(5)

End Sub

Note that the Column collection starts numbering at 0, not 1.
 
K

KARL DEWEY

Not sure what you want on the first item but for the second join the combo
source in your form query and use those fields to display the address, city,
and home phone number.

The first part could be done like this --
(SELECT [NameID], [LName] & ", " & [FName] ....
Bound Column: 1
Column Widths: 0"; 2.5"

It will display last name followed by a comma, space, and first name all in
the combo box.
 
S

SueW

Additional Information:

Senior Intake Table
SeniorIntakeID-PK
First
Middle
Last
Address
City
Township
State
PostalCode
HomePhone
BirthDate
Gender
Race
EmrgcyContactName
EmrgcyContactPhone

ScheduleTable
ScheduleID-PK
Driver
Day
First
Last
Address
City
HomePhone
AppointmentDate
PickUpTime
AppointmentTime
AppointmentNotes
Destination
ReturnTime
ReasonforTransportation
Cancelled
WhoCancelled
NoShow
UnableToSchedule

Want to create a combo box with the values from the Sr. Intake table to
populate the corresponding fields in the Schedule table. One of the purposes
of the database is to schedule senior/disabled client transportation
appointments.
 
K

KARL DEWEY

Do not repeat First, Last, Address, City, and HomePhone in ScheduleTable but
use SeniorIntakeID as foreign key. Setup a one-to-many relationship.
 

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

Top