Results 1 to 3 of 3
  1. #1
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51

    Populating a textbox from a combobox when entering a new record


    I am Populating the Team Id textbox located on the Employee Add/Remove form from the Pick a team combobox located on main menu. The problem is that when I go to add a new record using the Employee Add/Remove form the Team ID textbox is no longer automaticaly fill in.

    I am trying to find the vba code to put under on change of the Pick a Team combobox to fill this box in.
    I currently am using a query to populate the Employee Add/Remove form

    Thanks as always and sorry for this one because I am sure I missing something simple

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    if you use a combo box, with 2 query fields [id],[name], then hide the ID field using col widths: 0;2
    then the field gets the ID, and the user can see NAME. win/win in a single box.

    if you want to do the 2 box thing, ...same settings, except show the combo box ID field and hide the name: 1;0
    then in the combo AFTERUPDATE event, fill in the text box

    Code:
    sub cboBox_Afterupdate()
       txtName = cboBox.column(1)   'NOTE in vb, control columns start with zero. so col 2 in the property is cboBox.column(1)  in code.
    end sub
    or use a subform....fill in the ID box, the subform loads all the data for the ID.

  3. #3
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51
    Attachment 33140
    When Loading Second Form it is returning the value I am looking for.
    Attachment 33141
    The Second Form is Loaded and has the proper value in TeamID

    Attachment 33142
    Now when I go to add new record the value is no longer in TeamID.

    I would like to be able to edit records but if necessary to add a new record without having the person know the TeamID. That box is not visible normally.

    Thanks

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

Similar Threads

  1. Updating textbox - combobox per record
    By vincentsp in forum Forms
    Replies: 4
    Last Post: 02-18-2015, 08:09 AM
  2. Entering Data into Textbox as Search Criteria
    By Moonman in forum Programming
    Replies: 1
    Last Post: 12-16-2013, 06:11 PM
  3. Populating Textbox with Range of Time
    By athyeh in forum Programming
    Replies: 13
    Last Post: 08-13-2013, 02:52 PM
  4. Replies: 3
    Last Post: 05-16-2013, 08:21 PM
  5. Replies: 3
    Last Post: 08-03-2012, 02:37 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