the value of a tab control is equal to the page index of the currently
selected page in the control. so when you select the page whose page index
is 1, then
Me!Tabctl21 = 1
if you're wanting to *toggle* a control's Enabled property based on which
page of a tab control is currently selected, you can use some simple toggle
code, as
Me!ControlName.Enabled = (Me!Tabctl21 = 1)
in the above code, when the index number of the currently selected tab page
is 1, then the value of Tabctl21 = 1. Access evaluates the expression
(Me!tabctl21 = 1)
as True. so the setting of the Enabled property (of the named control) =
True.
if you want to *dis-able* the property when the specified page is currently
selected, alter the code slightly, as
Me!ControlName.Enabled = Not (Me!Tabctl21 = 1)
in the above code, (Me!Tabctl21 = 1) evaluates to True, so the expression is
Not True....in other words, False.
though i have to wonder why you're doing this. in Form view, the user can
only see the currently selected tab page at any given time. why DISable a
control only when a user moves to another page? s/he can't "get to" that
control without going to back the page it's on anyway. conversely, why
ENable a control when the user moves to another page? again, s/he can't get
to that control anyway, at that point.
hth
> I am using Access 2000
> I have a form (Prospects) with a Tab Control (Tabctl21) and some text box
[quoted text clipped - 18 lines]
>
> Can you show me the entire code i should use.
Chuck - 21 Sep 2007 15:14 GMT
Thanks, i see where i made the syntax error.
There are multiple controls on the form so i think i will run a loop
I maybe going about this the wrong way but when the user goes to the "Add
new Prospect" Tab, the existing fields are populated from a previous control
on another tab - so i dont want the user to over type what is there. I will
also have a button to "add new record" which can then turn the enabled=yes
property true for all the controls.
I guess i could disable edit property but i wanted a visual grey-out look so
the user had to hit the "add button" to start the add process.
Can you think of another way to accomplish this?
> the value of a tab control is equal to the page index of the currently
> selected page in the control. so when you select the page whose page index
[quoted text clipped - 57 lines]
> >
> > Can you show me the entire code i should use.
tina - 22 Sep 2007 05:32 GMT
okay, i understand why you're doing it, and running a loop on the controls,
setting the property with the toggle code as you loop, sounds reasonable to
me.
> when the user goes to the "Add
> new Prospect" Tab, the existing fields are populated from a previous control
> on another tab - so i dont want the user to over type what is there.
the above description does give me a bit of a chill, though. you're not
storing duplicate data in two tables, are you? or in "extra" fields in the
same table?
hth
> Thanks, i see where i made the syntax error.
> There are multiple controls on the form so i think i will run a loop
[quoted text clipped - 70 lines]
> > >
> > > Can you show me the entire code i should use.