Enter nickname to fill in full name in Access database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CindySue
    New Member
    • May 2007
    • 52

    Enter nickname to fill in full name in Access database

    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.
  • DeMan
    Top Contributor
    • Nov 2006
    • 1799

    #2
    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.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Originally posted by CindySue
      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:
      Code:
      Private Sub txtNickName_AfterUpdate()
        Me![txtNickName] = DLookup("[full name]", "nicknames", "[nickname]='" & Me![txtNickName] & "'")
      End Sub

      Comment

      • CindySue
        New Member
        • May 2007
        • 52

        #4
        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

        • CindySue
          New Member
          • May 2007
          • 52

          #5
          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

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            Originally posted by CindySue
            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.
            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 Sub

            Comment

            Working...