Results 1 to 4 of 4
  1. #1
    coach32 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2011
    Posts
    47

    Populating Text box after selection from Combo Box

    I have a table called 'Reasons' which has 3 columns of Data.


    ID - Number - Reasons
    I have a form that has data entered into it and this transfers onto a table (Complaints)
    On my form I have a ComboBox which consists of all the Reasons from the Reason table.
    I then have a text box that I wish to populate with the corresponding number of the reason. (EG: Duplication = Reason # 8)
    So I have placed the following code in the OnChange field of the TextBox.
    Code:
    Private Sub Text36_Change()
    RowSource "Select ID, Number, Reason From Reason"
    Me.Text36 = Me.Combo39.Column(1)
    End Sub
    Why is it that when I place the Reason for the complaint on the form and then create a new record, the actual
    reason number has placed itself in the Reason column and not the Reason # column in my main Table?
    Any guidance/assistance would be greatly appreciated. Thank you in advance.

  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,641
    Not clear on the question, but you realize the Column property is zero based, so your code refers to the second field, "Number"?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    coach32 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2011
    Posts
    47

    Populating Text box after selection from Combo Box

    Complaints.mdbI do apologise. I knew as I was writing it I wasn't being very clear.
    I have attached a sample Database. When I data entry into the Form, I select Incorrect Buyer.
    When I do this, I want the number 3 to appear in the reason # field on the Complaints Table.
    Instead the 3 places in the Reason field.

  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,641
    I think you want that in the after update event of the combo, not where it is:

    http://www.baldyweb.com/Autofill.htm
    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: 07-20-2015, 10:55 AM
  2. Replies: 2
    Last Post: 08-16-2012, 10:02 PM
  3. Replies: 3
    Last Post: 03-15-2012, 02:27 PM
  4. Replies: 9
    Last Post: 05-30-2011, 01:52 PM
  5. Replies: 3
    Last Post: 06-29-2010, 12:08 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