Hide Button

Gismo

Registered User.
Local time
Today, 11:34
Joined
Jun 12, 2017
Messages
1,298
Hi All,
Please could you assist?
I have a form with a text box displaying yes / no on a criteria called "Dual Master Loaded". If "Yes", I need a button, called "Link", that opens another form to be hidden, if not, button to be displayed for further action. Not sure what code to use or behind which action to be loaded. Please could you help?
 
I'd say the On_Current event of the form?
[
Code:
Me.cmdLink.Visible = NOT Me.DualMasterLoaded
 
If I've understood you correctly, something like this replacing with your own control names:

Code:
Private Sub cmdLink_Click()

	If Me.textboxName="Yes" Then
		DoCmd.OpenForm "frmFormName", , , , ,acHidden
        Else
		Me.cmdFurtherAction.Visible=True	
	End If

End Sub
 
Hi,
It looks like it could work, only i need to hide the button if text box value is yes, if no the button must be visable to select or the user may choose to do a manual input if he does not want to click the button, so another form must not open automatic if text box value is no
 
How about this then?

Code:
Private Sub cmdLink_Click()

	If Me.textboxName="Yes" Then
                Me.cmdFurtherAction.Visible=False
		DoCmd.OpenForm "frmFormName", , , , ,acHidden
        Else
		Me.cmdFurtherAction.Visible=True	
	End If

End Sub

If still not quite right, you should be able to tweak the code yourself from that
 
Thank you, i will work with that but i dont want to open a form, i just want the button to be visible or hidden depending on the text box value
 
Hi all,

Thank you for the replies, I tried all these but it is just not what I need and not working at all. I used the code in form current.
 
This is my code: Both the buttons are Hidden but then needs to be visible when text box value meets certain criteria. as for now, the hide bottoms seems to work fine but does not become visibe when criteria is met.

Private Sub Form_Current()
Me.Link.Visible = False
Me.Import.Visible = False
If Me.DualMasterLoaded = "No" Then
Me.Link.Visible = False
End If
If Me.DualMasterLoaded = "No" Then
Me.Import.Visible = True
End If
End Sub
 
You probably need an ELSE statement in there as well?
As your criteria is not testing for what happens when Yes? and in your original post that was when the button was going to be hidden?
 
Please try explaining what you want again as your code is very different to what you described in post 1.
What about the 'form to be hidden'?
Perhaps a screenshot would help?
 
It is just the button than needs to be hidded if text box = No, well there is 2 bottons as per code, on to display and other to hide when text box is no.
not sure how to post screen shots, let me have a look see
 
Capture.JPG
Capture1.JPG
 
It is just the button than needs to be hidded if text box = No, well there is 2 bottons as per code, on to display and other to hide when text box is no.
not sure how to post screen shots, let me have a look see

Still not at all clear to me.
Can you show the WHOLE form please
 
You do not need two buttons.
You need one button hidden or not. That button will open your form.

Code:
Private Sub Form_Current()

If Me.DualMasterLoaded = "No" Then
    Me.Link.Visible = True
Else
    Me.Link.Visible = False
End If

End Sub
This assumes the button for the form is the Link button and your original post is correct, and you can only have Yes or No for DulaMasterLoaded

HTH

It is just the button than needs to be hidded if text box = No, well there is 2 bottons as per code, on to display and other to hide when text box is no.
not sure how to post screen shots, let me have a look see
 
Thank you all, it works perfect, just had an issue with the yes / no criteria, it cam from a check box so I needed to use -1 for the yes criteria

Thank you once again
 
Thank you all, it works perfect, just had an issue with the yes / no criteria, it cam from a check box so I needed to use -1 for the yes criteria

Thank you once again

Are you sure?, I believe you could have used my first attempt in that case, just testing whether true or not?
 

Users who are viewing this thread

Back
Top Bottom