Update multiple fields on combo select

Obsoletedude

New member
Local time
Yesterday, 16:43
Joined
Nov 10, 2010
Messages
6
Hi.

What I have is a combo box with a list of employee names. On select, I would like my form to auto fill in the email text field and phone text field.

My field names are EmpName, EmpPhone and EmpEmail and these reside in an Employees Database, that is called in a Job form.

On the Form, they are the same names.

Any help would be great. I know this will be an event procedure for AfterUpdate, but just not good at knowing what to do in the code side of things.

Update, just so this seems easier. In the EmpName dropdown, I am already loading EmpID, EmpName, EmpPhone, and EmpEmail, but I have all the column widths set to 0" except the EmpName. Not sure if that helps.

Thanks
 
Last edited:
The code would look like:

Me.TextboxName = Me.ComboName.Column(x)

where x was the number of the column containing the desired info (the first column is 0)
 
Thanks pbaldy, but that's blankling out the box. Could it be because I have all the column widths set to 0?
 
No, but make sure the column count property is correct for the number of actual columns.
 
I have this:

Private Sub EmpName_Change()

Me.EmpID = Me.EmpName.Column(3)

Me.EmpEmail, = Me.EmpName.Column(1)
End Sub


My script in the EmpName field is simple, basically, select EmpName, EmpEmail, EmpPhone and EmpID in that order. The email does get updated, but the ID doesn't. The ID is a text (their initials) and the firld is text.
 
attachment.php
 

Attachments

  • makesurecolumncount.png
    makesurecolumncount.png
    33.7 KB · Views: 457
Last edited:
lol...yea yea yea. I saw that, and of course, I didn't actually look at the Column Count property. I played dumb and thought you meant the number of the column.

pbaldy, you rock! Works like a dream! Thanks!
 

Users who are viewing this thread

Back
Top Bottom