0
votes

I have a report in Access with a Preview/Print action this report has a few textboxes, I would like to check if an textbox is empty if so change the textbox background color before it’s Preview/Print.

Text box name = HomeMobile

What event should I use on the report: • Private Sub Report_Load() • Private Sub Report_Open(Cancel As Integer)

Private Sub Report_Open(Cancel As Integer)

If IsNull(Textbox.Value) = True Then
Textbox.BackColor = vbRed

End If

End Sub

screenshot

Not sure how to approach this. Your help is more than welcome! Thanks

2

2 Answers

0
votes

You could try with the Format or Print event, and also arrange for the colour to be reset:

Textbox.BackColor = IIf(IsNull(Textbox.Value), vbRed, vbWhite)
0
votes

Thanks for your inPut, I've an solution using Conditional Formatting. First I set the Back Color of all Text Boxes to grey as default (don't forget to set the Back style to normal and not transparent!)

Example text box HomeMobile (Layout view):

Select your text box and go to Conditional Formatting I use the Epression is [HomeMobile]>="" and set the color to white.

Now all empty HomeMobile text boxes in my report stay grey and the ones with a value will be white.