Datasheet Subform: Change Text Color by Row.

D

Downie

Ok, I've been at this for a few hours now.

I can't figure out why I can lock certain rows and columns leaving some
cells updatable with the below code:

Why can't change the color of that same cell that is unlocked and
updatable.

See "Me.active_jobs_msglog_crtdt.ForeColor = 69500"


Private Sub Form_Current()

If Me.updatable_item.Value = True Then
Me.updatable_item.Locked = True
Me.Job_Name.Locked = True
Me.active_jobs_msglog_crtdt.Locked = False
Me.active_jobs_msglog_crtdt.ForeColor = 69500
Me.completed_jobs_msglog_crtdt.Locked = False
Me.actual_process_time.Locked = True
Me.Estimated_Process_Time.Locked = True

Else
Me.updatable_item.Locked = True
Me.Job_Name.Locked = True
Me.active_jobs_msglog_crtdt.Locked = True
Me.completed_jobs_msglog_crtdt.Locked = True
Me.actual_process_time.Locked = True
Me.Estimated_Process_Time.Locked = True

End If

End Sub
 
A

Allen Browne

If you use the Current event to change the colors in a continuous form or
datasheet, Access applies the change to all rows.

In Access 2000 and later, you can use Conditional Formatting instead.
 
D

Downie

I am using Access 2002 - 2003.
I switched from datasheet to continous form
I added the following code to current_form and all rows are now RED,
like you said.

If Me.updatable_item.Value = True Then
Me.Job_Name.ForeColor = 66950
End If

Can you tell me how to incorporate the Conditional Formating?

Thanks
Rich
 
D

Downie

I am using Access 2002 - 2003.
I switched from datasheet to continous form
I added the following code to current_form and all rows are now RED,
like you said.

If Me.updatable_item.Value = True Then
Me.Job_Name.ForeColor = 66950
End If

Can you tell me how to incorporate the Conditional Formating?

Thanks
Rich
 
A

Allen Browne

Open the form in design view.

Select the control you want to change color

Choose Conditional Formatting from the Format menu.

In Condition 1, choose:
Expression [updatable_item] = True
and chose the color in the Text icon.

No code needed (unless you want a non-standard color.)
 
Top