Results 1 to 12 of 12
  1. #1
    royalbridge is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    6

    Text boxes auto fill after combo box update

    I'm an intern at a manufacturing facility. I've never used Access before but I'm willing to learn and appreciate all help!



    GOAL: select the IC number from the combo box and have 5 text boxes auto fill.

    AS OF NOW: I have a table made for the IC number drop down. The columns represent the fields that need to be auto filled.

    WHAT I THINK THE NEXT STEP IS: Making some kind of query to link the combo box entry to the text boxes? Some VBA where the control source is equal to my query? I have tried changing the text box control source to equal columns from my drop down but that did not work.

    NOTE: the blue font in the first image represents the text boxes that need to auto fill when I select the IC number from the drop down. The second image is my table from which my combo box is generated. The acronyms are for the two tests on this form. Sorry about the abbreviations in the table header.
    Click image for larger version. 

Name:	Capture3.PNG 
Views:	8 
Size:	24.1 KB 
ID:	21256Click image for larger version. 

Name:	Capture2.PNG 
Views:	8 
Size:	19.7 KB 
ID:	21255

  2. #2
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Should be able to:
    Design view of form select the IC number box, go to events tab in properties, click the (..) in after update
    Use this code:
    Code:
    Me.txtType = Me.cboIC.Column(2)
    Me.txtSMI = Me.cboIC.Column(3)
    Me.txtSMA = Me.cboIC.Column(4)
    Me.txtSpan = Me.cboIC.Column(5)
    Me.txtMinTemp = Me.cboIC.Column(6)
    Me.txtClass = Me.cboIC.Column(7)
    the "txt..." means the name of the textbox for each field (type, sma, smi, class, temp , etc)
    and cboIC means the name of your combo box for IC Number.

  3. #3
    royalbridge is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    6
    Quote Originally Posted by nick404 View Post
    Should be able to:
    Design view of form select the IC number box, go to events tab in properties, click the (..) in after update
    Use this code:
    Code:
    Me.txtType = Me.cboIC.Column(2)
    Me.txtSMI = Me.cboIC.Column(3)
    Me.txtSMA = Me.cboIC.Column(4)
    Me.txtSpan = Me.cboIC.Column(5)
    Me.txtMinTemp = Me.cboIC.Column(6)
    Me.txtClass = Me.cboIC.Column(7)
    the "txt..." means the name of the textbox for each field (type, sma, smi, class, temp , etc)
    and cboIC means the name of your combo box for IC Number.
    Thank you for the fast response. I had no luck with the VBA although it did not show a compiling error! The fields did not update. Here is my code:Click image for larger version. 

Name:	Capture4.PNG 
Views:	8 
Size:	11.9 KB 
ID:	21257

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    Note that Type is a reserved word so using it may result in misleading errors

    Rather than using code you could just put

    = Me.cboIC.Column(2) in the txtType control controlsource
    = Me.cboIC.Column(3) in the txtSMI control controlsource

    etc

  5. #5
    royalbridge is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    6
    All fields are unbound.. does that matter?

  6. #6
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    that error you are getting is an example of what can happen when you use reserved words - change the field and control name to something else - such as ICType

  7. #7
    royalbridge is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    6
    Ajax, I typed "Me.cboIC_NUMBERDD.Column(3)" in the control source for smi and the field says #NAME? in form view

  8. #8
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    sorry - I was just copy and pasting in a rush - you don't need the 'me.' part - and unless you have changed the name of your control, you don't need the 'cboIC_' either

    Also check that your combo has the number of columns set to 7

  9. #9
    royalbridge is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    6
    Okay thanks. I Changed that but the text box appears empty. I set my column count to 7. when I designed my combo box I only included the IC number. not the other columns

  10. #10
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Is your cbo getting its values from a table/query or did you type in the IC numbers by hand as a value list?

  11. #11
    royalbridge is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    6
    I got! Thank you so much Ajax!

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    If these textboxes are unbound and you are not saving these values to record, VBA code is not needed. Expression in textbox ControlSource can reference combobox column index, just as shown in the VBA.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 06-09-2013, 05:35 PM
  2. Replies: 5
    Last Post: 11-09-2012, 04:18 PM
  3. Combo Box auto fill and update table
    By memmons in forum Access
    Replies: 4
    Last Post: 09-27-2012, 11:58 AM
  4. auto fill text box from dependent combo box
    By tommyried in forum Access
    Replies: 6
    Last Post: 06-17-2012, 03:55 PM
  5. Replies: 15
    Last Post: 04-01-2011, 11:41 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