Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Loop through objects changing background color of certain kinds of objects

Geek News

Loop through objects changing background color of certain kinds of objects
BrianDP <bdp222[ at ]gmail.com> 11/26/2008 9:44:46 PM
I think that sums it up. If someone can help me, TIA.

Just to clarify- I have several forms- and I want to run a program
that will look at each one, and on each form, if the type of object is
a Header, Form, Footer, or Label, change it's background to a given
color.

Something like For each object in objects...? The syntax excapes me
at the moment.

-BrianDP
Re: Loop through objects changing background color of certain kinds of objects
"Paul Shapiro" <paul[ at ]hideme.broadwayData.com> 11/26/2008 10:52:49 PM
Is something like this what you're looking for?
Dim frm As AccessObject 'Temporary form
Dim fSuccess As Boolean 'Have we been successful?
'Initialize
fSuccess = True
For Each frm In CurrentProject.AllForms
fSuccess = fSuccess And FormSetBackgroundColor(frmName:=frm.Name)
Next frm

In FormSetBackgroundColor() you can loop through the Controls collection to
find labels. I don't think there is a Sections collection, but there are
indexes for each standard section type (Form Header, Page Header, Detail,
etc.).

In you can dimension frm as Access.Form:
Dim frm As Access.Form 'Form we're processing
'Open the form in design mode so we can access control properties
DoCmd.OpenForm FormName:=frmName, View:=acDesign
Set frm = Forms(frmName)


"BrianDP" <bdp222[ at ]gmail.com> wrote in message
news:bf10ac33-2551-4523-8189-05fec1bf1954[ at ]a26g2000prf.googlegroups.com...
[Quoted Text]
>I think that sums it up. If someone can help me, TIA.
>
> Just to clarify- I have several forms- and I want to run a program
> that will look at each one, and on each form, if the type of object is
> a Header, Form, Footer, or Label, change it's background to a given
> color.
>
> Something like For each object in objects...? The syntax excapes me
> at the moment.
>
> -BrianDP

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net