Form colours and Windows themes

T

Tony Williams

I posted a two questions yesterday concerning the colours of buttons on a
control tab and command buttons and had various useful suggestions as to
what I might do. However I think my problem is more fundamental. I have
designed a number of forms for my database which will be used by a number of
users. I have taken time to ensure the forms look aesthetically good, as
well as functional, with the use of coloured backgrounds. I now realise
though that the colour of tabcontrol buttons, command buttons and scroll
bars (and there may be other things) are dependent upon the colour scheme
that the user has on their machine. For example my forms which are
predominantly grey looked great in the classic windows style or XP silver
but if I switch to XP default which is blue all the aforementioned items are
beige which completely destroys the look of the forms. Is there any way to
force a particular style, say Windows Classic, when the data base opens?
I know I could use any of the suggestions that have been mentioned but this
would involve redesigning some 30 forms and 10 subforms and wouldn't I don't
think solve the scroll bar issue.
Thanks
Tony
 
J

Joan Wild

I think you have hit on a good reason not to use a lot of custom
colours/backgrounds in forms.

You need to respect the user's choice of colour scheme on their computer,
and not change it.

You can use the system colours to customize the look of your forms. Doing
so should ensure that they look good regardless of the user's choice of
scheme.

Search Help for system colors (watch the spelling) you'll get the
information you need.
 
T

Tony Williams

Thanks Joan I'll do that, but presumably whatever colours I choose am I
still not at the mercy of the user's choice of system colours. My database
could look different on every user's screen if they've all got different
schemes running?
Tony
 
J

Joan Wild

Yes you are, but it shouldn't matter. You can use a system colour for your
background, for example -2147483644 would make the background whatever
colour their menubar is.
 
T

Tony Williams

Thanks Joan I think I'm getting the hang of this. Just got to find an easy
way to change the backcolor of all my forms and subforms now :-(
Thanks again
Tony
 
J

Joan Wild

For Each doc In dbs.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
Forms(doc.Name).FormHeader.BackColor = -2147483633
Forms(doc.Name).FormFooter.BackColor = -2147483633
Forms(doc.Name).Detail.BackColor = -2147483633
DoCmd.Close acForm, Forms(doc.Name).Name, acSaveYes
Next
 
T

Tony Williams

Joan that looks fantastic only point is where do I put it and how do I run
it?
Sorry to be so dim but I'm a 61 year old "newbie" at this so am feeling my
way.
Thanks again
Tony
 
J

Joan Wild

In that case, create a new module (or open an existing one if you have it).
Copy and paste the following
Public Sub ChangeFormColours()

Dim dbs As DAO.Database
Dim doc As Document

Set dbs = CurrentDb()
For Each doc In dbs.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
Forms(doc.Name).FormHeader.BackColor = -2147483633
Forms(doc.Name).FormFooter.BackColor = -2147483633
Forms(doc.Name).Detail.BackColor = -2147483633
DoCmd.Close acForm, Forms(doc.Name).Name, acSaveYes
Next

End Sub

Go to the Debug menu and choose Compile Code, then hit the save button,
giving the module some name (but not ChangeFormColours).

Just hit Ctrl-G and type ChangeFormColours and hit enter.
 
T

Tony Williams

Thanks Joan
Did what you said and when I ran it I got
Runtime error 2465
Application-defined or object defined error
and the debug window highlighted
Forms(doc.Name).FormHeader.BackColor = -2147483633
Any ideas
Thanks for all your help
Tony
 
J

Joan Wild

It likely hit a form that didn't have a FormHeader.

After the Public Sub... line put
On Error Resume Next
 
T

Tony Williams

Joan sorry didn't get back to you yesterday, I'm in the Uk and after my last
message at 18.19 decided to call it a day (and it had been a long one!)
Anyway tried this morning worked perfectly. Thanks very much for all your
help.
Can I assume that with the relevant changes to the property references I
could use that module for amending any other property, globally?
Thanks again
Tony
 
J

Joan Wild

Yes. Now that you have your feet wet, don't be afraid to jump right in.

If you put your curcor on the word Forms and hit F1, you'll get information
on the methods and properties that pertain - there are lots of examples in
Help.
 
T

Tony Williams

Thanks a lot Joan, really helpful.
Tony
Joan Wild said:
Yes. Now that you have your feet wet, don't be afraid to jump right in.

If you put your curcor on the word Forms and hit F1, you'll get
information on the methods and properties that pertain - there are lots of
examples in Help.
 

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


Top