INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

*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

Jobs from Indeed

Automatically populate field value based on a combo box selection.

Automatically populate field value based on a combo box selection.

Automatically populate field value based on a combo box selection.

(OP)
Hello,
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.
  

RE: Automatically populate field value based on a combo box selection.

     
     Perhaps...

CODE

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

Randy

RE: Automatically populate field value based on a combo box selection.

(OP)
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?

RE: Automatically populate field value based on a combo box selection.


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

Randy

RE: Automatically populate field value based on a combo box selection.

(OP)
Hi Randy,

Is your form bound to the table?
YES

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

Table where I need the data to be stored:
tblCredit  
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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!

Resources

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