View Full Version : disable some buttons


deepbreath
07-06-2001, 04:27 AM
i have put some command buttons on my mainform, what i want to do is that when i open mainform directley all should be enabled, but when i come to mainform through another open form, certain buttons should be disabled. help plz

Chris RR
07-06-2001, 04:47 AM
Welllll.... You could set up a public variable:
Public strWhichForm As String
Then, each form always sets this variable:
strWhichForm = Me.Name
And your menu checks it (before it updates it, obviously...) to see where control came from:
If strWhichForm = "fSomewhereElse" Then
Me.btnXYZ.Enabled = False
Me.btnXYZ.Visible = False 'maybe?
Else
Me.btnXYZ.Enabled = True
Me.btnXYZ.Visible = True 'maybe?
End If
strWhichForm = Me.Name

deepbreath
07-07-2001, 02:45 AM
thanks, but where to put the code