Using VBA to pass a value from form to form

Zak14

Registered User.
Local time
Today, 04:47
Joined
Jun 27, 2014
Messages
166
Here's the scenario:

There's a button(Button1) on the main form (Form1) and on the second form (Form2).
On Form1, I've got a link(LinkToForm2) to Form2.


When people click on LinkToForm2, I want access to open Form2 and hide/show Button1 depending on whether it is shown/hidden in Form1.


Here's the question:

Is there a way to, maybe, set a value on Form1_Deactivate (depending on whether Button1 is shown/hidden),
So that, on Form2_Activate, it can check that value and hide/show Button1 accordingly?

Thanks!


There are a few pages on this subject, but all of them differ one way or another and I'm fairly new to VBA, so I'm kind of confused and not sure which way is best for me. Please feel free to simply point me in the right direction.
 
Last edited:
I would probably do it in the code opening the second form.

Forms!SecondForm.ButtonName.Visible = Me.ButtonName.Visible
 
Wow thanks i didn't know you could do that. i thought it would be more complicated
 

Users who are viewing this thread

Back
Top Bottom