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?
Subscribe to our Windows Secrets Newsletter - It's Free!
Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!
+ Get this BONUS — free!
Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!
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!