B
babs
I did the below post and it worked to highlight in yellow a job name if it is
double-clicked on - but I now need to add a color-light orange(peach) - to
hightlight job name - Yellow means impt for example and peach means it is
done. not sure best way tohandle this. ( used blnYelHighlight) below in
place of blnHoursAM - tied code to the double click on the job name field.
Any ideas- see prev. post below that I used but now need to handle multiple
formatting??
thanks,
barb
As John Goddard has said, you will need to use conditional formatting to
achieve this. To be able to change the background colour of a control at
the whim of the user independently of the value in the control, however, you
will need to add another column to the table for each column you wish to
highlight. These extra columns can be of Boolean (Yes/No) data type so that
their values can be toggled between True and False, providing a basis for an
expression on which to base the conditional formatting.
Taking a hypothetical example lets say you have a column HoursAM which
records the morning hours worked by an employee. You'd add a Boolean column
to the table, blnHoursAM say. In the DblClick event procedure of the HoursAM
control on your form change the value of the blnHoursAM column in the current
row of the table with:
Me.blnHoursAM = Not Me.blnHoursAM
This simply toggles the value of blnHoursAM between False and True. You
don't need to include a control bound to the blnHoursAM column in the form;
it just has to be in the form's underlying table or query.
To conditionally format the HoursAM control on the basis of the value in the
blnHoursAM column, in the conditional formatting dialogue for the blnHoursAM
control select 'Expression is' from the combo box on the left, enter
[blnHoursAM] in the text box to its right (make sure you include the square
brackets around the column name), and set the back colour to a colour of your
choice.
Ken Sheridan
Stafford, England
double-clicked on - but I now need to add a color-light orange(peach) - to
hightlight job name - Yellow means impt for example and peach means it is
done. not sure best way tohandle this. ( used blnYelHighlight) below in
place of blnHoursAM - tied code to the double click on the job name field.
Any ideas- see prev. post below that I used but now need to handle multiple
formatting??
thanks,
barb
As John Goddard has said, you will need to use conditional formatting to
achieve this. To be able to change the background colour of a control at
the whim of the user independently of the value in the control, however, you
will need to add another column to the table for each column you wish to
highlight. These extra columns can be of Boolean (Yes/No) data type so that
their values can be toggled between True and False, providing a basis for an
expression on which to base the conditional formatting.
Taking a hypothetical example lets say you have a column HoursAM which
records the morning hours worked by an employee. You'd add a Boolean column
to the table, blnHoursAM say. In the DblClick event procedure of the HoursAM
control on your form change the value of the blnHoursAM column in the current
row of the table with:
Me.blnHoursAM = Not Me.blnHoursAM
This simply toggles the value of blnHoursAM between False and True. You
don't need to include a control bound to the blnHoursAM column in the form;
it just has to be in the form's underlying table or query.
To conditionally format the HoursAM control on the basis of the value in the
blnHoursAM column, in the conditional formatting dialogue for the blnHoursAM
control select 'Expression is' from the combo box on the left, enter
[blnHoursAM] in the text box to its right (make sure you include the square
brackets around the column name), and set the back colour to a colour of your
choice.
Ken Sheridan
Stafford, England