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 / Forms Programming / July 2005

Tip: Looking for answers? Try searching our database.

Changing back color of subforms when main form is in Data Entry mo

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Darrell - 29 Jul 2005 02:37 GMT
My purpose is to give the user an unmistakable sign when they have opened a
form in Data Entry mode by changing the back color of the form and all
subforms. Rather than hard coding the name of each subform, I would like to
loop through the controls of the main form and if they are subforms, change
their back color (having determined that the form is in Data Entry mode, of
course).

This is the code I have tried so far:
       Dim ctl As Control
       For Each ctl In Me.Controls
           If TypeOf ctl Is SubForm Then
               
'Forms!frmTape!subfrmTapeProcedure.Form.Section(acDetail).BackColor = 9211609
               'Me.Controls(ctl.Name).Form.Section(acDetail).BackColor =
9211609
           End If
       Next ctl

Can someone enlighten me as to what the syntax should be, or how else I
should attack this?
Signature

Darrell

Marshall Barton - 29 Jul 2005 05:06 GMT
>My purpose is to give the user an unmistakable sign when they have opened a
>form in Data Entry mode by changing the back color of the form and all
[quoted text clipped - 16 lines]
>Can someone enlighten me as to what the syntax should be, or how else I
>should attack this?

Try this:

Dim ctl As Control
    For Each ctl In Me.Controls
        If ctl.ControlType = acSubForm Then
            ctl.Form.Section(acDetail).BackColor = 9211609
        End If
    Next ctl

Signature

Marsh
MVP [MS Access]

Darrell - 29 Jul 2005 16:45 GMT
Marshall, you're a genius! Thank you very much! It saved me a lot of time
going down other false paths since I thought I had just about exhausted the
syntax variations (I had tried several other variations since posting last
evening).

Obviously, a second benefit is knowing that other possible issues, like
trying other events to associate this with are not necessary. I now know that
properties of subforms CAN be addressed in the load event of the main form.

Thanks again!
Signature

Darrell

> >My purpose is to give the user an unmistakable sign when they have opened a
> >form in Data Entry mode by changing the back color of the form and all
[quoted text clipped - 25 lines]
>         End If
>     Next ctl
 
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.