Problem setting enable property of tab control

G

gaugust

I have 3 pages in a tab control. Each page has a subform. I manually set the
enable property of pages 2 and 3 in the tab control to false. I would like to
set the enable property of pages 2 and 3 to true in the after update event of
the combo boxes in subform 1 (page 1). The names of pages 2 and 3 in the tab
control are Page2 and Page3. I have tried the following:

If Me.Combo58.ListIndex = 0 Or Me.Combo58.ListIndex = 1 Then
Forms!frmMain!Page2.Form.Enabled = True
Forms!frmMain!Page3.Form.Enabled = True
Else
Forms!frmMain!Page2.Form.Enabled = False
Forms!frmMain!Page3.Form.Enabled = False
End If

This code is not working. I have tried a number of different combinations,
but have not found code that works. Could you let me know what the correct
syntax is?

Thanks.
 
M

Mr. B

I have 3 pages in a tab control. Each page has a subform. I manually set the
enable property of pages 2 and 3 in the tab control to false. I would like to
set the enable property of pages 2 and 3 to true in the after update event of
the combo boxes in subform 1 (page 1). The names of pages 2 and 3 in the tab
control are Page2 and Page3. I have tried the following:

If Me.Combo58.ListIndex = 0 Or Me.Combo58.ListIndex = 1 Then
Forms!frmMain!Page2.Form.Enabled = True
Forms!frmMain!Page3.Form.Enabled = True
Else
Forms!frmMain!Page2.Form.Enabled = False
Forms!frmMain!Page3.Form.Enabled = False
End If

This code is not working. I have tried a number of different combinations,
but have not found code that works. Could you let me know what the correct
syntax is?

Thanks.

Try:

Forms![frmMain!Page2]![Page2] .enabled = false

HTH

Mr B
 
G

gaugust

Yes, That works!, Thanks

Mr. B said:
I have 3 pages in a tab control. Each page has a subform. I manually set the
enable property of pages 2 and 3 in the tab control to false. I would like to
set the enable property of pages 2 and 3 to true in the after update event of
the combo boxes in subform 1 (page 1). The names of pages 2 and 3 in the tab
control are Page2 and Page3. I have tried the following:

If Me.Combo58.ListIndex = 0 Or Me.Combo58.ListIndex = 1 Then
Forms!frmMain!Page2.Form.Enabled = True
Forms!frmMain!Page3.Form.Enabled = True
Else
Forms!frmMain!Page2.Form.Enabled = False
Forms!frmMain!Page3.Form.Enabled = False
End If

This code is not working. I have tried a number of different combinations,
but have not found code that works. Could you let me know what the correct
syntax is?

Thanks.

Try:

Forms![frmMain!Page2]![Page2] .enabled = false

HTH

Mr B
 
G

George Nicholson

Pages on a tab control are referenced via the pages collection of the tab
control. They are not separate entities.

To enable a tab:
frmMain.tabMain.Pages("Page2").Enabled = True



To enable a subform on a tab:
Forms!frmMain!Page2.Form.Enabled = True
A Form doesn't have an Enabled property, so "...Form.Enabled..." would
always fail. However, the *control* containing the subform does have an
enabled property that can be used.
so rather than:
frmMain.ctlContainingSubform.Form.Enabled = True
you would want:
frmMain.ctlContainingSubform.Enabled = True

Note that ALL controls on a tab control, regardless of what page they are
on, are part of the PARENT form's control collection.
(Try giving 2 controls on different pages the same name. You can't.) So, you
do not need to know what page a control is on to reference it, you just need
it's name.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top