Results 1 to 8 of 8
  1. #1
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131

    Combo Box Fills another field

    This seems easy but it's not coming to me. I created a combo box (it has 2 fields, Account Number and Display Name) in a temp form that contains all the account numbers from a table that has had account numbers entered. Sometimes the Display Name is input if it is different from the account name other times it is left blank.

    I would like to take the field number 2 (Display Name) from the combo box and put it into the temp form that also has a field named Display Name after the Account number is entered if the display name is not blank from the combo box.

    Does this make sense?

  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
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131
    I tried the following

    Private Sub AccountNumberSelect_AfterUpdate()
    Period = PeriodSelect
    DisplayName = AccountNumberSelect.DisplayName
    End Sub

    AccountNumberSelect is my combo box name and Display name is the second field name in the query. When I do an update I get

    Compile Error:

    Method or data number not found.

  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
    Why don't you try what I suggest in my link?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131
    Sorry I thought I did. Do I use Column(2) instead of the name of the field?

  6. #6
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131
    I used Column(1) and that worked. Thanks for your help.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Yes. The 2 would be the number of the column containing the desired data, and is zero based, so 2 would refer to the third actual column.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  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
    Oops, we were typing at the same time. Glad it worked for you.
    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. How to set a query field a combo box
    By mar_t in forum Access
    Replies: 3
    Last Post: 12-17-2010, 12:21 AM
  2. auto populate combo field?
    By myboii in forum Access
    Replies: 8
    Last Post: 07-09-2010, 05:46 AM
  3. Combo Box field selection help needed
    By techexpressinc in forum Forms
    Replies: 8
    Last Post: 04-01-2010, 09:42 AM
  4. Use a combo box to populate a text field
    By niesenj in forum Forms
    Replies: 2
    Last Post: 01-29-2010, 01:57 PM
  5. Replies: 0
    Last Post: 02-27-2009, 01:27 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