Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Coding

Status
Not open for further replies.

Unser

Technical User
May 10, 2010
4
US
Okay here's the question, it's probably a simple one for everyone here, but
I've been trying for over a month now and can't get this right. I have a
form, and on this form there is a combo box at the top with the names of
certain people, and below that are text boxes which should have something
other than #NAME in them. These names were taken from a table from the same
databse (obviously). Also on the table are other pieces of information about
them (coulmns) that have their first name, last name, city, state, zip, etc.
In case anybody doesn't yet get where I'm going with this, the form is
(supposed to be) a mirror of the table, but I want to have it so that when
you click someone's name on the combo box in the form, all the other info
magically appears in the text boxes below the combo box. I have been working
with this: , and it is
exactly what I want to do, but it's not working for me. Can anyone help me,
please? Thanks
 
I won't download your file. Can you provide the significant properties of your controls on your form? Typically we have text boxes that reference columns from the combo box control like:
=cboEmployee.Column(x)
The x is the column number where 0 is the first column.

Duane
Hook'D on Access
MS Access MVP
 
Thanks for your reply. Okay, the combo box just has ID, First Name and Last Name. The table I'm basing the form off of has those three columns, plus address, city, state, zip and their e-mail address. As for this "=cboEmployee.Column(x)", I understand it goes in the combo box control column, but unless I'm mistaken, the "cbo" represents the combo box name right? So I would put cboNameOfTextBox.Column(#), is this correct?
 
You are somewhat correct. My suggestion assumed the full name of your combo box was "cboEmployee". Also, your control source of your text box must start with "=".

I would add the other needed fields to the combo box row source.
Code:
SELECT ID, FirstName, LastName, Address, City, State, Zip, EMail 
FROM tblEmployee
ORDER BY FirstName, LastName;
It shouldn't make any difference what the name of the text boxes are as long as they are not the name of a field in your form's record source.

Duane
Hook'D on Access
MS Access MVP
 
Okay thank you for that, I'm pretty sure that covers the first part of my problem, as the stuff I want is showing in the combo box. But when I click on a name in the combo box, I don't know what code to put in the AfterUpdate section to make it so that when I click on a name, that persons info would be displayed below in the corresponding text boxes on the form. Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top