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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoFill Text Box continued 1

Status
Not open for further replies.

math20

MIS
Jul 7, 2005
71
CA
This works for one text box, now I want to autofill other text boxes. Such as Pick the name, and, the ID, the mgr name and mgr ID fills in automatically.
I am trying to automatically fill 3 more text boxes once I fill in one text box. I am using the process below which works for me to fill one text box but not more than that.

I have the comboboxes row source changed to:
SELECT ID, Name, mgr ID, mgr Name FROM tblStaff ORDER BY 5

Then, in the AfterUpdate event procedure of that combo:

Me![Box2] = Me![Combo1].Column(1)
Me![Box3] = Me![Combo1].Column(2)
Me![Box4] = Me![Combo1].Column(3)
Me![Box5] = Me![Combo1].Column(4)

But this only updates the first column and not the others. Can you please tell me what I am doing wrong?

Thanks.
 
Hi
This:
[tt]SELECT ID, Name, mgr ID, mgr Name FROM tblStaff ORDER BY 5[/tt]
Looks a little odd, but I guess it is not a cut and paste.
You need to set the Column Count for the combo for the code above to work.
 
How are ya math20 . . . . .

Be aware: [blue]Column Index[/blue] starts at zero, and includes any hidden columns (width set to zero) in the [blue]Column Widths[/blue] property.

Now . . . as for you select statement . . . you show 4 fields [blue]ID, Name, mgr ID, mgr Name[/blue]. Is [blue]mgr Name[/blue] one field, or is a comma missing?

Calvin.gif
See Ya! . . . . . .
 
Hi The ACeMan1,

No, Mgr_Name is one field. So I see what you mean about the column starting at zero and the column widths property. It works now .

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top