Results 1 to 6 of 6
  1. #1
    jlindquist23 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jan 2019
    Posts
    43

    Use combo box to fill multiple fields

    I'm using a combo box to fill in multiple fields in my form using the on change command:


    Private Sub cboItemNo_Change()
    Me.txtRC_LCL.Value = Me.cboItemNo.Column(1)
    Me.txtRC_UCL.Value = Me.cboItemNo.Column(2)
    Me.txtSagePotTemp.Value = Me.cboItemNo.Column(3)
    Me.txtSageQTemp.Value = Me.cboItemNo.Column(4)
    End Sub

    I'm not sure why it will only use 3 of the 4 columns. Is there a limit on columns? I changed to column numbers on these two lines to see if it was my formula:
    Me.txtSagePotTemp.Value = Me.cboItemNo.Column(4)
    Me.txtSageQTemp.Value = Me.cboItemNo.Column(3)

    An then the QTemp started filling and not the PotTemp. Again...Columns 1 - 3 work. It's when I add a 4th.
    Thanks for the help!!

  2. #2
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Combo column numbering starts at (0) being the first column.

    Is that your issue ?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    jlindquist23 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jan 2019
    Posts
    43
    The zero column is the key column. Then there is 4 columns of data after that.

  4. #4
    jlindquist23 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jan 2019
    Posts
    43
    It was the column count in the combo box. I had it set at 3. When I set it to 4, it worked!!!

  5. #5
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Glad you sorted it
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    And I would suggest you move the code to the AfterUpdate event of the combo-box as OnChange fires for every keystroke.
    Cheers,
    Vlad

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

Similar Threads

  1. Replies: 4
    Last Post: 10-13-2014, 09:20 AM
  2. Fill multiple fields with the same information
    By ben_jamin in forum Access
    Replies: 4
    Last Post: 07-23-2013, 07:24 AM
  3. Replies: 3
    Last Post: 03-21-2012, 01:43 PM
  4. Using a combo box to fill in other fields
    By mccluein in forum Access
    Replies: 1
    Last Post: 03-14-2011, 05:40 PM
  5. How To Fill In Multiple Fields From A Form
    By SamanthaSamuels in forum Access
    Replies: 3
    Last Post: 08-16-2010, 12:13 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