Results 1 to 6 of 6
  1. #1
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108

    auto populate description when code is entered...

    Hello,


    I am trying to have my form auto fill the description for a code that is entered. The code and description are in the same table. I have been researching but I cant find an explanation of the code... I know I need to use the afterupdate.

    The field to enter the code is CaseStatusCode and the description field is StatusCodeDescription. I am trying:

    Private Sub CaseStatusCode_AfterUpdate()
    Me.StatusCodeDescription = Me.CaseStatusCode(1)
    End Sub

    obviously this isn't working... I am not sure what the "me." part means, from reading the (1) sets the second column of the table. the one thing I was reading says the first column of a table is (0). I have been looking and finding various stuff I have been trying but I would like to understand what im doing... I have it set up to populate when the user clicks on an "update" button, but I would like it to auto populate. I have figured out the auto populate using the afterupdate, but that was just with some calculations.

    If more info is needed please let me know.
    Will

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Syntax is not quite right, see here:

    BaldyWeb - Autofill
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108
    thanks for the link pdaldy... still leaves me with some questions though...

    "If you only wanted to see the name in the combo, you would hide the ID and Phone fields (column width of 0). Then on your Orders form to view the phone number of the selected customer, you'd have a textbox with a control source of:=ComboName.Column(2)"

    The article really didn't explain the how to set it up, or im just really slow and missed it... On my form I have a lookup field that lists all the codes, descriptions, and wait periods from tbl_Data_CaseStatusCode. How do I pull data from the second column (the descriptions) and auto populate them to my form?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Have you tried just fixing the syntax of what you have to:

    Me.StatusCodeDescription = Me.CaseStatusCode.Column(1)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108
    that was it... thanks pb

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help! By the way, "Me" is a shortcut to refer to the object containing it (in your case the form). In other words

    Me.TextboxName

    is the same as

    Forms!FormName.TextboxName

    It also gives you intellisense, where when you type "Me." you get a dropdown of the available controls, methods, etc.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 08-15-2014, 12:03 PM
  2. Replies: 1
    Last Post: 08-10-2014, 04:06 PM
  3. Replies: 1
    Last Post: 08-05-2014, 12:40 PM
  4. Replies: 3
    Last Post: 04-03-2014, 08:13 AM
  5. i want to show description when i write the code
    By Mina Garas in forum Access
    Replies: 3
    Last Post: 02-23-2012, 11:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums