Smart questions
Smart answers
Smart people
Join Tek-Tips Forums

Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Automatically populate field value based on a combo box selection.

murphy123 (TechnicalUser) (OP)
27 Jan 12 13:27
I've been trying to automatically populate the field value based on a combo box selection. I've looked for help in many postings and everything that I try simply doesn't work for me.

I have a couple of fields in a table that has ID numbers and all I need is their descriptions to automatically populate. I don't need to select more than one choice per combo box. Once data is collected it will be stored into a table. I am using a form to make these selections. My first combo box is a UserID box, which I need the very next field to populate the UserID Name. I will also have another combo box on the same form for Account#, then I need Account Name (this information is not in the User_IDs table.

For my first combo:
On the row source of the UserID I have the following code: SELECT [User_IDs].[UserID] FROM User_IDs ORDER BY [UserID];

Things that I have tried and hasn't worked so far, not sure what I am doing wrong. Tried on After Update, On Change, Click...

Private Sub UserIDs_AfterUpdate()

Me.User_Name = Me.UserIDs.Column(1)

End Sub

I don't how to create a column count if that's need.

Any help is greatly appreciated or other suggestions. I've spent a lot time reading through postings. Thanks all.
randy700 (Programmer)
27 Jan 12 13:36


Me.User_Name = DLookup("User_Name", "Usur_IDs", "UserID = " & Me.User_ID)


murphy123 (TechnicalUser) (OP)
27 Jan 12 14:11
Thanks Randy. I tried the code, but I'm getting an error msg.

"The expression you entered as a query parameter produced this error:" ...then it gives me the userID that I selected. The Name values are Null.

Any other suggestions?
randy700 (Programmer)
27 Jan 12 16:03

     Is your form bound to the table?
     Which table?  Field names, please.
     Did you use the wizard to build your combo box?


murphy123 (TechnicalUser) (OP)
27 Jan 12 16:17
Hi Randy,

Is your form bound to the table?

Which table?  
Field names, please.
The table where the User detail is:
Fields: UserName, UserID

Table where I need the data to be stored:
fields: CSC_ID, CSC_Name (there are several other fields)
The fields that I need to auto populate is called is CSC_Name.
The CSC_ID is the same as UserID from the LAN_IDs table.

Did you use the wizard to build your combo box?
I have used wizard. It didn't work and I also added the Unbound combo, which I wasn't able to make it work either.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close