Results 1 to 8 of 8
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    autopopulate not working

    all,
    using access 2003. have a form based on a table. have a combo box based on its own recordsource(table). I would like to autopopulate another field on the form once i select a record from the combobox. ex.
    the combobox recordsource contains an id field and description. when i select the id from the combobox i would like the description in the text field next to it to autopopulate. I have tried the following in the control source of the text box:


    Code:
    Me.TextboxName = Me.ComboName.Column(2)
    doesnt work. gives me the error #Name
    what am i doing wrong
    Thanks

  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
    That is VBA code that would go in the after update event of the combo. The control source of the textbox would be the name of the field you want that data stored in:

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

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    I did this. me.txt_Carriername=me.CarrierID.column (2)? I am placing this in the control source of the field named txt_Carriername where I want the data placed in the table.

  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
    Again, that is VBA code that can only go in the VBA editor. It will error as the control source.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    O ok. so how do I get this field to populate for the combo box?
    Thanks

  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
    Like I said, that code is intended for the after update event of the combo:

    http://www.baldyweb.com/FirstVBA.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Got it! So can I use the same concept when I want to pull up a previous id# and have it pull up the corresponding record? ex.
    When the user types in an invoice # for a previous entered record on a subform; can corresponding fields be populated based on the invoice #? Do I use the same concept VBA code?
    Thanks

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not clear on what you're doing, but presuming you want to pull information related to the selected item in the combo, sure.
    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: 1
    Last Post: 06-21-2011, 03:34 AM
  2. Replies: 3
    Last Post: 05-26-2011, 12:52 PM
  3. Replies: 9
    Last Post: 09-23-2010, 10:42 AM
  4. Autopopulate NOT allowing overwrite
    By ChrisCione in forum Forms
    Replies: 8
    Last Post: 09-03-2010, 06:29 PM
  5. Acess autopopulate a query
    By stendec in forum Access
    Replies: 0
    Last Post: 10-20-2009, 03:49 PM

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