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.
Enter nickname to fill in full name in Access database
Collapse
X
-
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. -
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:Originally posted by CindySueI'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.
Code:Private Sub txtNickName_AfterUpdate() Me![txtNickName] = DLookup("[full name]", "nicknames", "[nickname]='" & Me![txtNickName] & "'") End SubComment
-
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.Comment
-
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.Comment
-
Originally posted by CindySueI 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.Code:Private Sub txtNickName_AfterUpdate() 'See if a Full Name exists If Len( Me![txtNickName] = DLookup("[full name]", "nicknames", "[nickname]='" & Me![txtNickName] & "'")) > 0 Then Me![txtNickName] = DLookup("[full name]", "nicknames", "[nickname]='" & Me![txtNickName] & "'") Else 'a Full Name doesn't exist End If End SubComment
Comment