field.ForeColor = #666666 error???

M

M Skabialka

In Access 2007 I have a form with a save button whose forecolor is #666666
If changes are made to data on the form I want to change the color to back
and bold. When they have saved their changes I want it to go back to not
bold and forecolor = #666666.

My code has this to change it when the form is dirty - this works:
cmdSaveChanges.FontBold = True
cmdSaveChanges.ForeColor = 0 'black

But I get compile errors for these trying to set it back:
cmdSaveChanges.ForeColor = #666666 'compile error: Expected:
Expression
cmdSaveChanges.ForeColor = "#666666" 'type mismatch
How do I set it back to forecolor #666666?
 
D

Douglas J. Steele

You sure the forecolor is #666666? I don't have Access 2007 installed on
this machine, so I can't check, but in previous versions of Access, the
property was strictly numeric, and #666666 isn't a numeric value. It's
possible that the property window will accept such a value, but that doesn't
mean it's stored that way (just as widths can be entered as inches, but
they're stored as twips)

What does

MsgBox "ForeColor = " & cmdSaveChanges.ForeColor

pop up?
 
M

M Skabialka

ForeColor = 6710886

Thank-you for showing me how to extract the real color code. In Access 2007
many of the colors are represented by such numbers e.g. #BBB6AE. Click on
the ellipsis under properties on the form or report, choose a color, and you
get a 6 character alphanumeric number such as these preceded by #.

I was able to set the color to 6710886 which is what I wanted, and yes the
color really was #666666 on the form.
Thanks,
Mich
 

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

Top