Populate text boxes from combo box selection???

option

Registered User.
Local time
Yesterday, 22:26
Joined
Jul 3, 2008
Messages
143
Hi again!

My new dilemma is such:

I have a table of about 16,000 records, each one being an employee. In order to fill out their daily forms, they currently have to manually type in all of their information (name, department so on...). With this table already populated with the basics, is there a way I can have them choose their record from a combo box (by their employee ID, which is my tables primary key) and have it populate the remaining text boxes asking for their name and such? You guys have been great here and I appreciate it! Thanks!!!:)
 
create a query with all the fields you would like to display for each employee. then create a form based on that query and add an unbound combo box to your form and populate with the employees names. Reference your unbound combo i.e Forms!FormName!ComboName as a criteria in your query.
 
Assuming the source for the combo is something like
Code:
SELECT Field1, Field2, Field3, etc.
FROM tablename;
Then if only the one field's data is visible to select from, you could add something like the following to the After Update event of the combo box
Code:
txt_Field2 = Combobox.column(1)
txt_Field3 = Combobox.column(2)
etc.
Would that help you?
 
Thanks for the tips, but I just can't seem to grasp this whole thing. max, when I tried it your way, i couldn't choose any record besides the first. And Alc, I tried that with no success as well. Thanks for the quick response though, +rep
 
You're welcome.
Could you provide a bit more info
1) The name of the form, the combo box and at least one field you want populated
2) The SQL behind the combo box
 
Thanks for the tips, but I just can't seem to grasp this whole thing. max, when I tried it your way, i couldn't choose any record besides the first.

do you mean your combo wasn't populated right or the form did not display the correct records after first use?

If the first please post the sql behind your combo. If the latter, make sure you put a Me.Requery on the AfterUpdate event of your combo.
 
You're welcome.
Could you provide a bit more info
1) The name of the form, the combo box and at least one field you want populated
2) The SQL behind the combo box

Form Name: EmpDoc
Combo Box: empID
Fields to populate (for now): Emp_LName, Emp_FName

As far as the SQL, all I see is "Row Source: SELECT [EmpTable].[AgentID] FROM [EmpTable]". Hope that helps :confused::confused:
 
Try changing the row source to
Code:
Row Source: SELECT [EmpTable].[AgentID], [EmpTable].{[I]second field}[/I] FROM [EmpTable]
where the second field is whichever one you want to populate Emp_LName with.
In the AfterUpdate event of the EmpID combo box put
Code:
Emp_LName = EmpID.Column(1)
Does that work, when you change the value in the combo box?
 
s3qctu.gif

I get that error.
 
s3qctu.gif

I get that error.
My fault, I should have stressed that the {} were just to indicate that this was a value you'd have to decide on. Try it with [] instead.
 
Did that, same error lol. I realized that after I made the screen cap that those needed changing.
 
Is there an Emp_LName field in that table?
 
Yes there is. I made sure to copy the columns name and paste it in just to be safe and not put a cap where there shouldn't be lol.
 
Combo Boxes!!!

Text boxes can sometimes be a pain when it comes to this sort of thing i find, You could try turning all your text boxes into comboboxes and just setting their attributes so that they can't drop down.
Set the row source of each combobox to their respective field, but add in a where the IDfield = [ID combobox in form]
Now each combobox looks for the value in it's field that matches the ID selected on the form. All you have to do as far as programing in VBA goes is to set an event on after update that requeries every combobox.

ie.

me.combobox2.requery
me.combobox3.requery...

As soon as the person selects their ID each combobox will update.
 
Hmm...I think I'm just getting in over my head on this. I'm quite new to Access, so maybe I should just keep tinkering on hahaha. I can't seem to get this to work out for me. Thanks anyway guys :)
 
Here is a stripped down version of what we have. It only has one generic record and form. Thanks for the encouragement!!
 

Attachments

Didn't get a chance to look at it until today, but there doesn't appear to be a combo box on the form?
 

Users who are viewing this thread

Back
Top Bottom