Results 1 to 3 of 3
  1. #1
    New Lounger Ensemble's Avatar
    Join Date
    Apr 2013
    Location
    Centurion
    Posts
    23
    Thanks
    9
    Thanked 1 Time in 1 Post

    Updating form values from subform.

    On my form I have a button with the following on click event:

    txtUserFirstName = txtEmployeeName
    txtuserLastName = txtEmployeeLastName
    txtUserEmail = txtEmployeeEmail
    txtUserOfficeNumber = txtEmployeeOfficeNumber
    txtUserMobileNumber = txtEmployeeMobileNumber
    txtUserTitle = txtJobTitleDescription
    txtUsername = txtUserLastName & ", " & txtUserFirstName

    The form also has a subform with the following at the end of the after update event:

    Forms!frmUserAdmin!txtUserFirstName = txtEmployeeName
    Forms!frmUserAdmin!txtuserLastName = txtEmployeeLastName
    Forms!frmUserAdmin!txtUserEmail = txtEmployeeEmail
    Forms!frmUserAdmin!txtUserOfficeNumber = txtEmployeeOfficeNumber
    Forms!frmUserAdmin!txtUserMobileNumber = txtEmployeeMobileNumber
    Forms!frmUserAdmin!txtUserTitle = txtJobTitleDescription
    Forms!frmUserAdmin!txtUsername = txtuserLastName & ", " & txtUserFirstName

    My problem is that the onclick for the button works 100%, but for the after update, it only updates txtUserTitle.

    Any Idea why?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,328
    Thanks
    1
    Thanked 13 Times in 13 Posts
    I have trouble believing the button works and the afterupdate doesn't!

    I'm assuming the button is on the main form. If so, on the first line of the code you have txtUsderFirstName = txtEmployeeName. Both of those are on the main form?

    On the first line of code for the afterupdate event you have: Forms!frmUserAdmin!txtUserFirstName = txtEmployeeName
    Is txtEmployeeName on the subform?

    BTW, in the future you would be better served to use Parent.txtUserFirstName from the subform when referencing a control on the main form.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    New Lounger Ensemble's Avatar
    Join Date
    Apr 2013
    Location
    Centurion
    Posts
    23
    Thanks
    9
    Thanked 1 Time in 1 Post
    The fields updating from does not all reside on the subform, though some do. I fixxed the code by adding Parent. in front of all field references.

    Duh - Icecream to my forehead!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •