Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2007

Tip: Looking for answers? Try searching our database.

Tab control Changes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chuck - 21 Sep 2007 05:06 GMT
I am using Access 2000
I have a form (Prospects) with a Tab Control (Tabctl21) and some text box
controls on a Tab called "Add Prospects", Page Index =1. I'm trying to turn
Enable Property off on these controls using on Change event procedure. I cant
get the controls to change only for this tab (Im using msgbox to test). Its
happeing for all tabs. here is the code i am using:

I've tried many combinations where the ????? are including Page.count to no
avail.

Private Sub TabCtl21_Change()
Dim ctrl As Control
Dim tci As Integer
tci = Me.TabCtl21.?????????
If tci = 1 Then
MsgBox "You are on Page AP"
Else
MsgBox "You are NOT on Page AP"
End If
End Sub

Can you show me the entire code i should use.
tina - 21 Sep 2007 05:52 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.