button referencing

J

John

I am working with a tab control on a mainform and when I
click on certain tabs I need to have a button disabled.
The following is the last effort I tried. I placed this
in the OnClick event of the tab page. What am I missing
as it does not work? The button is on the mainform.

Mainform = usrfrmClaims
button = cmdusrfrmClientInformationAddNew
tab page = pagClientLocationInformation
tab control = TabCtl43

Forms!usrfrmClaims!
cmdusrfrmClientInformationAddNew.Enabled = False

Thanks in advance for assistance.
 
A

Allen Browne

Use the Change event of the tab control, to set the Visible property of the
button.

The Value of the tab control will be the same as the PageIndex property of
the page, so:

Me.cmdusrfrmClientInformationAddNew.Visible = _
Not (Me.TabCtl43.Value = Me.pagClientLocationInformation.PageIndex)
 
Top