Change colour on command button

G

Guest

Hello,

I have a command button on a form, cmdComments, and it has the letter "i" on
it. This command button opens a Comments popup form and allows the user to
either view or add comments for each record. The comments field (called
TaskDesc) in the Comments popup form is a field that is part of the table the
main form is based on (tblTasks). I would like that letter "i" to be the
colour red if there are comments already entered for a record and remain
black if there are no comments added. Any help would be appreciated.

Thanks,
Janet
 
M

Marshall Barton

JanetF said:
I have a command button on a form, cmdComments, and it has the letter "i" on
it. This command button opens a Comments popup form and allows the user to
either view or add comments for each record. The comments field (called
TaskDesc) in the Comments popup form is a field that is part of the table the
main form is based on (tblTasks). I would like that letter "i" to be the
colour red if there are comments already entered for a record and remain
black if there are no comments added. Any help would be appreciated.


As long as the form is opened in Single Form View, you can
use code something like:

If Nz(Me.TaskDesc, "") = "" Then
Me.cmdComments.ForeColor = vbBlack
Else
Me.cmdComments.ForeColor = vbRed
End If

in the form's Current event.

You might want to also use analogous code in the popup
form's Close event.
 

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