I would like to address this issue of ‘Conditional Formatting’ so often addressed in this forum. I have become rather frustrated with the fact that Access only allows three different formats when using their wizard. I have an application used in the transportation industry to track truck dispatching. In frmLoadBoard (continuous) the cmbOrderStatus has 15 different status’. While I believe there are at least some cases where this could be reduced (i.e. some could have a “shared” BackColor), I understand that ElseIf has no limitations (assuming that is the correct code usage).
I created a little db (to experiment with) with similar cmbOrderStatus in frmOrderDetail (normal). I then created frmLoadBoard (continuous) with txtStatus. My first brick-wall was trying to figure out where to put the code. I couldn’t see where this formatting would be an “event” for the txtBox, so I entered the following in the OnOpen event of frmLoadBoard:
If txtStatus = “ASSIGNED” Then
txtStatus.BackColor = 16777164
ElseIf txtStatus = “BILLED” Then
txtStatus.BackColor = 16765673
ElseIf txtStatus = “NEW” Then
txtStatus.BackColor = 255
End If
I then created 15 records with all of the possible status’ and opened frmLoadBoard. (Note that I only coded 3 possible formats – I didn’t want to bother with all 15 until I was certain I was on the right track). frmLoadBoard only displayed the correct BackColor for the first status (“ASSIGNED”) and ignored all the other coding (i.e. “BILLED” and “NEW”). If you click on any of the txtBoxes in the display (regardless of their status) it changes the BackColor to that for “ASSIGNED” (16777164). Somewhat discouraged, I thought perhaps the coding actually should be placed in the properties of the txtOrderStatus, but (as I previously mentioned) I cannot for the life of me determine where the code should be placed. Also, I don’t know if the code is even correct. One issue that comes to mind (and assuming the coding would go in the frmLoadBoard OnOpen event), we already are using that event in the application to display a count of new orders from frmOrderNew.
frmLoadBoard (continuous) is a visual display of orders that greatly aids the operator in seeing at a glance what status’ the orders are in. By double clicking any single order number they call the frmOrderDetail for editing – no entries/edits are actually made in frmLoadBoard. To be able to assign different BackColor to each txtStatus creates a display that instantly informs the operator if something is amiss.
As always, any and all assistance/input/comments greatly appreciated.