Results 1 to 3 of 3
2014-01-10, 07:46 #1
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?
2014-01-12, 21:18 #2
- Join Date
- Jun 2001
- Crystal Beach, FL, Florida, USA
- Thanked 12 Times in 12 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.
2014-01-24, 07:42 #3
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!