Client wants to change color scheme for 50+ forms

  • Thread starter George Nicholson
  • Start date
G

George Nicholson

A client wants to change the color scheme for 50+ forms.

1) Anyone know of an already existing tool available to assist with this
before I try to create my own? [ Cause I sure ain't about to do it all
manually:) ]

My biggest concern (other than boredom) is that the form background will be
changing from Black to White and I'm a little worried about overlooking
labels/controls that currently have white forecolor or backcolor, so I need
to make sure I catch everything.

2) Is there a way to set a series of constants via code that can be plugged
into Backcolor, Forecolor properties sort of like creating my own set of
Windows color scheme constants? I figure, as long as I'm doing this I might
as well be prepared for the client to want to change their color choices yet
again (which, based on the current choices, I suspect they will be doing).
It would be nice to be able to just change the value of a set of constants
and have the app colors change (without changing the Windows color scheme).

3) I currently have a small (embedded) logo that is appearing on all forms
and reports. Is there a better way to set that up to be easily replaced? I
don't want to link to an external file, but I'm wondering if I can link to a
single instance of the logo stored somewhere in the mdb rather than
embedding/storing it 50+ times.
 
M

mscertified

It's fairly easy to write a loop to navigate thru all forms and all controls
on each form. And it's fairly easy to test and/or set the properties of each
control.

This code opens all forms in design view:

Dim obj As AccessObject, DBS As Object
Set DBS = Application.CurrentProject

'Search for open AccessObject objects in AllForms collection.
'An error occurs when trying to open a subform after the main form is
already open.

'Pass through and open all forms that have "sub" in the name first.
For Each obj In DBS.AllForms
If InStr(1, obj.Name, "sub") Then
DoCmd.OpenForm obj.Name, acDesign
End If
Next

'Then pass through and open all forms that start with "s".
For Each obj In DBS.AllForms
If Left(obj.Name, 1) = "s" Then
DoCmd.OpenForm obj.Name, acDesign
End If
Next

'Then open all forms...
For Each obj In DBS.AllForms
DoCmd.OpenForm obj.Name, acDesign
Next

This code loops thru forms (it does other stuff also but you can extract
what you need):

Dim o As Form, ctl As Control
Dim R As New ADODB.Recordset
R.Open "zSource", CurrentProject.Connection, adOpenDynamic, adLockOptimistic

For Each o In Forms

'Add form RecordSource...
R.AddNew
R!ObjectType = "Form"
R!ObjectName = o.Name
If Nz(o.RecordSource, "") <> "" Then
R!Source = o.RecordSource
End If
R.Update

'Add RowSource, ControlSource and LimitToList property of comboboxes and
listboxes in current form...
For Each ctl In o
If ctl.ControlType = acComboBox Or ctl.ControlType = acListBox Then

R.AddNew
R!ObjectType = "Form"
R!ObjectName = o.Name

If ctl.ControlType = acComboBox Then
R!ControlType = "Combo Box"
ElseIf ctl.ControlType = acListBox Then
R!ControlType = "List Box"
End If

If Nz(ctl.ControlSource, "") <> "" Then
R!ControlControlSource = ctl.ControlSource
End If

If ctl.ControlType = acComboBox Then
R!LimitToList = ctl.LimitToList
End If

R!ControlName = ctl.Name
If Nz(ctl.RowSource, "") <> "" Then
R!Source = ctl.RowSource
End If
R.Update
End If
Next ctl
Next o

R.Close
Set R = Nothing

This code closes all forms:

Dim obj As AccessObject, DBS As Object
Set DBS = Application.CurrentProject

'Turn off warnings so save changes prompt won't appear...
DoCmd.SetWarnings False

' Search for open AccessObject objects in AllForms collection.
For Each obj In DBS.AllForms
DoCmd.Close acForm, obj.Name
Next

DoCmd.SetWarnings True


Tip: Make a backup of your DB before you run your code as it won't work the
first time.

-Dorian

George Nicholson said:
A client wants to change the color scheme for 50+ forms.

1) Anyone know of an already existing tool available to assist with this
before I try to create my own? [ Cause I sure ain't about to do it all
manually:) ]

My biggest concern (other than boredom) is that the form background will be
changing from Black to White and I'm a little worried about overlooking
labels/controls that currently have white forecolor or backcolor, so I need
to make sure I catch everything.

2) Is there a way to set a series of constants via code that can be plugged
into Backcolor, Forecolor properties sort of like creating my own set of
Windows color scheme constants? I figure, as long as I'm doing this I might
as well be prepared for the client to want to change their color choices yet
again (which, based on the current choices, I suspect they will be doing).
It would be nice to be able to just change the value of a set of constants
and have the app colors change (without changing the Windows color scheme).

3) I currently have a small (embedded) logo that is appearing on all forms
and reports. Is there a better way to set that up to be easily replaced? I
don't want to link to an external file, but I'm wondering if I can link to a
single instance of the logo stored somewhere in the mdb rather than
embedding/storing it 50+ times.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Windows 7 Default page color for e-mail (Outlook) 1
color scheme changed 1
change color scheme in VBA 5
Access 2007 MDI background Color 3
Custom color scheme 2
Color scheme help 7
Help With Color Scheme Change 3
Change the color scheme 1

Top