Color Coding Report Details

  • Thread starter Thread starter Brennan
  • Start date Start date
B

Brennan

Hello:

I have a Access 2000 database that has a series of reports
that track the status of pending bids for an electrical
contractor. Based upon the value in the status field, I
would like to color code the individual record in the
Detail section to a particular color. I cannot use the
conditional formatting that comes with Access because that
only provides me with 3 variables where in this case I
need 6 or 7.

I have been using the following code:

Private Sub Detail_Format(Cancel As Integer, FormatCount
As Integer)

If [tblBids_Status] = "Pending" Then
[tblBids_JobID].ForeColor = vbRed
[tblbids_Contractor].Forecolor = vbRed
End If

End Sub
(Note: The original code contains all of the fields that
make up a record. I just abbreviated it here to save
space)

My problem is that this code changes the color for ALL of
the reocrds regardless of what the value in the Status
field. I just want to change the color of the records
where the value in the Status field meets the criteria.

I would also like to know where I can get a list of all of
the colors in Access that I can reference with code.

Is this possible in Access? Any suggestions would be
appreciated.

Brennan
 
Brennan,
Once you turn the color to red, you must turn it back to whatever if the
condition is not met.

If [tblBids_Status] = "Pending" Then
[tblBids_JobID].ForeColor = vbRed
[tblbids_Contractor].Forecolor = vbRed
Elseif [tblBids_Status= "Complete" Then
[tblBids_JobID].ForeColor = vbBlue
[tblbids_Contractor].Forecolor = vbBlue
Elseif etc...
Elseif etc...
Else
[tblBids_JobID].ForeColor = vbBlack
[tblbids_Contractor].Forecolor = vbBlack
End If
 
Back
Top