Hidden Buttons

jbates83

New member
Local time
Today, 23:00
Joined
Jul 21, 2003
Messages
7
If I have a button thats has visible set to no, how can I have a second button make it visible?
 
on the second button's OnClick() event:

Me.cmdYourOtherButton.Visible = True
 
Maybe I am an idiot, but it didn't work.
 
Try putting this code

Me.cmdYourOtherButton.Visible = True

in the command button OnClick event procedure. Substitute "cmdYourOtherButton" with the name of your other command button.

If you're new at creating event procedures, please see Access help under "creating event procedures".

Hope this helps,
 
If I click on a button, can I have it disappear? I am curious how, it says that I can't hide a control that has the focus, so how do I make it disappear
 
Last edited:
Set the focus to another control first.
 
Code:
Private Sub cmdThisButton_Click()
    Me.ctlOtherControl.SetFocus
    Me.cmdThisButton.Visible = False
End Sub
 
I know that I am being annoying, but what is the procedure to close a form when a button is clicked and/or run a macro?
 
Last edited:
To close the active form:

Code:
DoCmd.Close acForm, Me.Name


To close an inactive form:

Code:
DoCmd.Close acForm, Forms!frmYourFormName

or

Code:
DoCmd.Close acForm, Forms("frmYourFormName")


To run a macro:


Code:
DoCmd.RunMacro "YourMacroName"
 
I am trying to make a yes or no exit message box
if it is yes I want it to exit the form
if it is no I want it to go back to the form, but I cant seemk to get it right. Can someone help me?
 
Code:
If MsgBox("Do you wish to close this form?", vbQuestion + vbYesNo, "Title Here") = vbYes Then
    DoCmd.Close acForm, Me.Name
End If
 

Users who are viewing this thread

Back
Top Bottom