Connie Jerdet-Skehan
asked on
Copy all value in one form to another
I am using access 2016
I am using a navigation form = Main
on the navigation form I have a primary landlord =navigationbutton39 (navigationsubform is derived from form "primary landlord verification")
and a spouse landlord = navigationbutton 111 (navigationsubform is derived from form 'spouse landlord verification")
if me.spousesame = -1 on spouse landlord form
I would like whatever is on the primary landlord form to be copied over.
I seem to be having trouble getting the right syntax to reference the forms. Is there a way to do this??
screenshots.pdf
I am using a navigation form = Main
on the navigation form I have a primary landlord =navigationbutton39 (navigationsubform is derived from form "primary landlord verification")
and a spouse landlord = navigationbutton 111 (navigationsubform is derived from form 'spouse landlord verification")
if me.spousesame = -1 on spouse landlord form
I would like whatever is on the primary landlord form to be copied over.
I seem to be having trouble getting the right syntax to reference the forms. Is there a way to do this??
screenshots.pdf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the advice gentlemen.
2. A subform can be referenced from the main form either by an absolute path or by a dynamic path.
Absolute Path Example
--------------------------
[Forms]![MainForm's Name]![Subform's Name]![Name of control on subform]
Dynamic Path Example
--------------------------
[Name of subform control].[Form]![Name of control on subform]
As much as possible, use dynamic paths because you won't have a problem if the main form is renamed in the future during development. Access doesn't always auto-update name changes; especially in macros.
To copy over details of one subform to another, use the SetValue action in macros. You will have to specify which controls and fields you want to copy and which control you want to copy its content/value to.
If SpouseSame= Yes , Then
SetValue of:
[Name of subform2 control].[Form]![Name of control on subform2]
To:
[Name of subform1 control].[Form]![Name of control on subform1]
Ensure you click on the 'Show All Actions' button on the ribbon so that you can get access to the SetValue action.
After constructing the SetValue Action, you can call the macro from the After-Update event of the SpouseSame control.
Cheers.
SetValue-Illustration.JPG