1 Command Button 2 actions

Dummy

Dummy User
Local time
Today, 05:24
Joined
Mar 7, 2005
Messages
25
In a Form i have a Command Button where with it i want to Load and Unload a Subform, and each time i Click its caption changes, to Load or Unload.

shall i do 2 command buttons and play with visible property?....like 2 command buttons on top of each other when one is clicked its visible property is set to false...and the other command button appears.

OR Can i do this in One Command Button "on Click" event? if yes what shall be

the code please?

Thank you
 
The clue is in the Static keyword:

Code:
Private cmdButton_Click()
    Static x As Boolean
    If x = False Then
        Me.cmdButton.Caption = "Unload"
        x = True
    Else
        Me.cmdButton.Caption = "Load"
        x = False
    End If
 
Thanks McAbney:)
 

Users who are viewing this thread

Back
Top Bottom