Results 1 to 3 of 3
  1. #1
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80

    Coding button to use combo box to update table field

    I have a table with all employee information on it.
    On the main form I have the option for someone to set a surrogate if they are going to be gone for a while. It is a combo box where they select the employee they wish to set. What I want this to do is turn the 'SurrogateTeam' field on the tblEmployeeInfo table of the employee selected, to match the 'EmployeeID' of the person doing the action. So the combo box would have Bob, if I select Bob and my employee ID is 54, it sets his SurrogateTeam to 54. A button after this to return the surrogate team to match the persons own employeeId would be great as well



    EmployeeID of the person logged on can be found in the [Forms]![frmLogin]![cboUser] file, and the employeeID for the person being selected is in the combo box as well.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    The combo box would have 2 fields : NAME, ID
    bound column =2
    column width of col.2 =0
    control source=SurrogateTeam

    User sets the Surrogate Team Id.
    then when needs to go back , set it back to your ID.

  3. #3
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80
    I was actually able to get it to work using the following code:
    Code:
    CurrentDb.Execute "Update tblEmployeeFiles set SurrogateTeam = '" & Forms!frmLogin!cboUser.Column(0) & "' Where EmployeeID = " & Me!SurrogateSelect.Column(3), dbFailOnError
    What I am trying to do now is, I have a list box on the form which shows who is currently a surrogate and I want it where if you click on the name in the list box it changes THAT persons SurrogateTeam back to match their EmployeeID. I thought reverse engineering it would be easy but I can't figure this one out. The list box is named SurrogateNames and contains FirstName, LastName, EmployeeID, and SurrogateTeam.

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

Similar Threads

  1. Replies: 7
    Last Post: 12-09-2014, 12:24 PM
  2. Replies: 15
    Last Post: 07-22-2014, 07:32 PM
  3. Combo box update field in a different table
    By deadringer86 in forum Forms
    Replies: 3
    Last Post: 12-28-2012, 05:10 PM
  4. Coding an "update" button
    By Nick F in forum Programming
    Replies: 6
    Last Post: 11-16-2012, 09:38 AM
  5. Replies: 1
    Last Post: 08-09-2012, 04:19 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