• Updating form values from subform.

    Author
    Topic
    #492826

    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?

    Viewing 1 reply thread
    Author
    Replies
    • #1433454

      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.

    • #1435552

      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!

    Viewing 1 reply thread
    Reply To: Updating form values from subform.

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: