How are ya NXMold . . .
I ran a successful simulation on this so here we go.
[ol][li]On each page of the TabCtl put a question mark [blue]
?[/blue] [red](no quotations please)[/red] in the [blue]Tag[/blue] property of each control that has a [blue]Locked[/blue] property. Not every object has a locked property, so you'll have to check before setting the tag property. Just keep the properties window open on the [blue]Data[/blue] tab and you'll know as you set focus to each object.[/li]
[li]Make sure your VBA variables are in the declaration section of a module in the modules window. In simulation I used:
Code:
[blue]Option Compare Database
Option Explicit
Public pg0 As Boolean, pg1 As Boolean, pg2 As Boolean[/blue]
Note: Page Index starts at 0.[/li]
[li]In the same module copy/paste the following routine:
Code:
[blue]Public Sub LockTC(TC As TabControl)
Dim pg As Page, ctl As Control, flg As Boolean
For Each pg In TC.Pages
flg = Choose(pg.PageIndex + 1, pg0, pg1, pg2)
For Each ctl In pg.Controls
If ctl.Tag = "?" Then
ctl.Locked = flg
End If
Next
Next
End Sub[/blue]
[/li][/ol]
Finally to call the routine:
[ol][li]From within the form where the tabcontrol resides (mainform or subform):
Code:
[blue] Call LockTC(Me![purple][b][i]TabControlName[/i][/b][/purple])[/blue]
[/li]
[li]For external control use any proper form/subform referencing to the tabcontrol:
Code:
[blue] Call LockTC(Forms![purple][b][i]MainFormName[/i][/b][/purple]![purple][b][i]TabControlName[/i][/b][/purple])[/blue]
or
[blue] Call LockTC(Forms![purple][b][i]MainFormName[/i][/b][/purple]![purple][b][i]subFormName[/i][/b][/purple].Form![purple][b][i]TabControlName[/i][/b][/purple])[/blue]
[/li][/ol]
As a test set the forms [blue]On Open[/blue] event to:
Code:
[blue] pg0 = True
pg1 = True
pg2 = True[/blue]
Then set the forms [blue]On Load[/blue] event to:
Code:
[blue] Call LockTC(Me![purple][b][i]TabCtlName[/i][/b][/purple])[/blue]
All controls with question marks in their [blue]Tag[/blue] property should be locked (can't edit).
[blue]Your Thoughts? . . .[/blue]
See Ya! . . . . . .
Be sure to see thread181-473997 [blue]Worthy Reading![/blue]
![[thumbsup2] [thumbsup2] [thumbsup2]](/data/assets/smilies/thumbsup2.gif)
Also faq181-2886 [blue]Worthy Reading![/blue]
![[thumbsup2] [thumbsup2] [thumbsup2]](/data/assets/smilies/thumbsup2.gif)