disable command button when...

pavlos

Registered User.
Local time
Today, 22:56
Joined
Mar 10, 2009
Messages
79
Hi,

This forum has been a great help so far!

I have a tabbed form with 5 pages. What's the code to use so that when i am viewing ONLY a certain page (for example page 2) to disable a button command on the form?

I guess in the On_curent event of the form I have to use a code that looks like

Private Sub Form_Current()
Form!cmdNewContact.Enabled = “when page 2 is activated or focused, etc”
End Sub


Any help?
 
Form!cmdNewContact.Enabled = iif(Page = 2,True,False)

Page = 2,True,False
This bit you need to supply yourself based on the correct criteria.

David
 
DCrake many thanks for replying! Actually this condition part I am looking for...

How can the IIF function give True or False as result when I am opening only page2?

Isn't there any function that looks like IfActive(page2) then gives True or False?
 
DCrake,

Eventually i managed to short it out

Here is the code i used to disable 3 command buttons in all tabbed pages apart from the first.

Private Sub tabContacts_Change()
Form!cmdNewContact.Enabled = IIf(Form!tabContacts = 0, True, False)
Form!DeleteRegistration.Enabled = IIf(Form!tabContacts = 0, True, False)
Form!cmdCreateOutlookContact.Enabled = IIf(Form!tabContacts = 0, True, False)
End Sub

Many thanks for helping!
 

Users who are viewing this thread

Back
Top Bottom