Button changes color

R

reeve13

I was able to create a pop up notes box in a continuous form by usin
the zoom feature. What I want to happen next is...if the pop up bo
contains any notes/messages/comments, the button will change color t
indicate so.

Thanks
 
N

Nikos Yannacopoulos

AFAIK Access doesn't offer built-in functionality for changing button
colors. You can use a workaround such as superimposing a colored
rectangle and toggling its Visible property, or using a label instead of
a button (its Click event will work just fine!) or just changing the
button's font color. Personally, I toggle the button's Enabled property,
which turns it to phantom when disabled, and does the job fine as far as
I'm concerned... or when I need several different enabled states, I
change the caption and the font color.

HTH,
Nikos
 
R

reeve13

Nikos, I created the toggle button but how would I enable the button'
property which turns it to phantom when disabled as per you
suggestion?

Thanks
 
N

Nikos Yannacopoulos

You can ste the button's Enabled property to true/false in code, like:

Me.TheButtonName.Enabled = True

or

Me.TheButtonName.Enabled = False

....but I couldn't tell you what event to use or what to check, I'm not
clear as to how your form is set up. I guess you would have to check for
the existence of notes or whatever, where they are supposed to be stored
(e.g. through a DCount function).

Note, though, that this will not work on a continuous form, if you plan
to put the button in the detail section, so you have a button in each
record; the problem is, each time the code runs, it will enable /
disable the button in all records, not just the current one. One
workaround would be to put the button in the form header or footer
section, and use the form's current event to enable / disable that
single button depending on the current record.

HTH,
Nikos
 
Top