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

Enter nickname to fill in full name in Access database

P: 52
I'm not a programmer. I have a table called nicknames with two fields--a nickname field and a full name field. I also have a Licensed Provider table with a full name field and some other info. I have a form to enter new licensed providers. I want to be able to enter the nickname in a field and then have it fill in the full name field. I've been looking for ways but everything I try gives me the message that there is no macro with that name, so I'm doing something wrong. Can anyone help with something simple? I'd like something I can put in the after update property. Thanks.
May 15 '07 #1
Share this Question
Share on Google+
5 Replies


DeMan
100+
P: 1,806
Hi CindySue,

Welcome to the scripts. This appears to be a question for the Access forum so I will move it to the appropriate place. While you will be able to access this thread still by clicking on the link, you will find a link to the Access forum in a drop-down list from the "Forums" tab on the blue bar at the top of your screen.
May 15 '07 #2

ADezii
Expert 5K+
P: 8,638
I'm not a programmer. I have a table called nicknames with two fields--a nickname field and a full name field. I also have a Licensed Provider table with a full name field and some other info. I have a form to enter new licensed providers. I want to be able to enter the nickname in a field and then have it fill in the full name field. I've been looking for ways but everything I try gives me the message that there is no macro with that name, so I'm doing something wrong. Can anyone help with something simple? I'd like something I can put in the after update property. Thanks.
Assuming the Text Box you are entering the nickname in is called txtNickName, then to replace the nickname with the full name in the same Text Box, place this code in the AfterUpdate() Event of the Text Box:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtNickName_AfterUpdate()
  2.   Me![txtNickName] = DLookup("[full name]", "nicknames", "[nickname]='" & Me![txtNickName] & "'")
  3. End Sub
May 16 '07 #3

P: 52
I'm sorry, but I can't get this to work. I copied the code, went to the After Event box and pasted, but that gives me the message it can't find the macro. I tried then selecting event procedure and pasting the code there, and it give me a message that says runtime error, you cancelled the previous operation.
May 16 '07 #4

P: 52
I just got that to work. I think I had an s on nickname. Sometimes there won't be a nickname. Could I have the txtnickname box to enter a nickname if one existed (which I would know) and then it would put the full name in the full name text box? That way I could just skip the nickname box if I knew a nickname didn't exist and use a drop down to select the full name. I tried to change the names to the full name box, but not having much success. Thanks so very much for you help.
May 16 '07 #5

ADezii
Expert 5K+
P: 8,638
I just got that to work. I think I had an s on nickname. Sometimes there won't be a nickname. Could I have the txtnickname box to enter a nickname if one existed (which I would know) and then it would put the full name in the full name text box? That way I could just skip the nickname box if I knew a nickname didn't exist and use a drop down to select the full name. I tried to change the names to the full name box, but not having much success. Thanks so very much for you help.
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtNickName_AfterUpdate()
  2. 'See if a Full Name exists
  3. If Len( Me![txtNickName] = DLookup("[full name]", "nicknames", "[nickname]='" & Me![txtNickName] & "'")) > 0 Then 
  4.   Me![txtNickName] = DLookup("[full name]", "nicknames", "[nickname]='" & Me![txtNickName] & "'")
  5. Else
  6.   'a Full Name doesn't exist
  7. End If
  8. End Sub
May 16 '07 #6

Post your reply

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