By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,376 Members | 559 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,376 IT Pros & Developers. It's quick & easy.

How to link text boxes

P: 3
I am trying to link a text box Employee ID (EMPLID) so that when the user enters the EMPLID the NAME appears in the second text box called NAME. Here is what I have so far...I keep getting runtime errors though...

Expand|Select|Wrap|Line Numbers
  1. Private Sub EMPLID_AfterUpdate()
  2.    Me!NAME = DLookup("NAME", "PS_PERONSAL_DATA", "EMPLID" = "" & Me!EMPLID.Value & "NAME")
  3. End Sub
Jun 1 '10 #1
Share this Question
Share on Google+
3 Replies

missinglinq
Expert 2.5K+
P: 3,532
What are you trying to do with

& "NAME"?

This is tacking the word "Name" onto control named EMPLID in your form, which makes no sense to me. If EMPLID is Numeric then
Expand|Select|Wrap|Line Numbers
  1. Me!NAME = DLookup("NAME", "PS_PERONSAL_DATA", "[EMPLID] = " & Me!EMPLID.Value)
should work. If EMPLID is Text then it would be
Expand|Select|Wrap|Line Numbers
  1. Me!NAME = DLookup("NAME", "PS_PERONSAL_DATA", "[EMPLID] = '" & Me!EMPLID.Value & "'")
  2.  
You also need to change your field name to something other than Name, which is a Reserved Word in Access. It's very apt to confuse the Access Gnomes, sooner or later.

Also note that when error messages are being incurred, it would really help to post those errors when starting a thread.

Welcome to Bytes!

Linq ;0)>
Jun 1 '10 #2

P: 3
@Routergal
Thank you so much for your help. EMPLID was a number and I fixed my code. It works great.
Jun 1 '10 #3

missinglinq
Expert 2.5K+
P: 3,532
Glad we could help!

Linq ;0)>
Jun 2 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.