VBA code for setting the color of records in subform

K

kris

I have subform which is in datasheet view.The subform has a field called
[Status],I want the color of the record( color of the text) to be dependent
on the value of the [Status] field.I have 5 different values for [Status] so
i cannot use the CF in the menu.I have tried the following code as a test for
two value of status,but no luck so far...

Private Sub Form_AfterUpdate()
Select Case Forms![Requirement-status]![requirement-status-display
subform].Form.[Status]
Case Pass
Forms![Requirement-status]![requirement-status-display
subform].Form.[Status].BackColor = 1699999
Case Fail
Forms![Requirement-status]![requirement-status-display
subform].Form.[Status].BackColor = 1675555

End Sub

I tried Me.[Status].Backcolor=value...but it dint work.
I tried putting it under "Private Sub Form_Query()" event also but no result.
I have limited knowledge on VBA coding and new to MS access.CAn anyone
suggest me where I went wrong.
 

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