When working with forms, it is often hard to zero in on the important data. Color is one way you can ensure certain data stands out from the rest. For example, you can use color to emphasize that a customer has a $0 balance and, therefore, is eligible for a cash discount. Follow these steps:
- Open the form in Design View.
- Right-click the form and select Properties.
- Click the drop-down arrow under Selection Type and select Form (Figure A).
- In the Event tab, click the On Current property box, click Event Procedure, and then click the Build button (Figure B)
- Enter the following code at the prompt:
If Me.Balance > 0 Then
.ForeColor = vbWhite
.BackColor = vbRed
.FontBold = True
.ForeColor = vbBlack
.BackColor = vbWhite
.FontBold = False
End WithEnd If
- Press Alt + Q.
Miss an Access tip?
Check out the Microsoft Access archive and catch up on other Access tips.
Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.