Button Visible/Invisible depening unon contents of other control on Form

Fozi

Registered User.
Local time
Today, 19:12
Joined
Feb 28, 2006
Messages
137
I have a form which has a button to take the user to another form. However I wish this button to be invisible unless another control on the form is ticked.

I know it's an If then else..statement but not sure of VBA syntax or where to place the code.

The conditional control is a Y/N field.

Thanks
Fozi
 
On the Form...Load Event
Code:
Me.CommandButton.Visible = False

On the After Update Event of the field that turns on the button.
Code:
If Me.Field = True then 
    Me.CommandButton.Visible = True
Else
    Me.CommandButton.Visible = False
End If
 
Thanks Magic Man

Almost there. Getting a Data Type mismatch using the following:

Private Sub Was_Expression_of_Interest_Submitted_AfterUpdate()
If "[Was_Expression_of_Interest_Submitted]" = True Then
Me.BTN_EOI.Visible = True
Else
Me.BTN_EOI.Visible = False
End If
End Sub
 
Replace "[Was_Expression_of_Interest_Submitted]" with Me.Was_Expression_of_Interest_Submitted
 
Cheers mate. Code doing it's job. However what's happening is the button doesnt appear on load (as instructed) and only appears when the Submission Field is updated (as instructed).

As I step through records without amending the field I want the screen to show determine whether or not to show the button on the basis of the Submission field entry.
 
Ahh....ok move from form load to form OnCurrent. This will make the button dissappear on each new record.

Or
The field is already populated? In that case move the code from Was_Expression_of_Interest_Submitted_AfterUpdate
to
Form OnCurrent
And
Remove the one line from the form load.
 
Last edited:
Genius...many thanks. Easy when you know how!

Would you have time to work through another dilemma regarding euro calculations on a form and trying to prevent these changing when the exchange rate is updated?
 
Actually bed time....but if you post the issue, there are many good people on the forum who can help you,
 
Kool mate. Thanks for your help.
 
You can shorten your code (just 1 line of code):
Me.CommandButton.Visible = Me.Was_Expression_of_Interest_Submitted

HTH
 

Users who are viewing this thread

Back
Top Bottom