OnFormat event in report detail is hiding a field on ALL records (vs individual records)

ChrisCione

Board Regular
Joined
Aug 27, 2008
Messages
92
Office Version
  1. 365
Platform
  1. Windows
I have the following code as an On Format event for the detail section of a report.

Code:
If Me.txtReferralReturnedDate = Null Then
    Me.txtReferralDueDate.Visible = True
Else
    Me.txtReferralDueDate.Visible = False
End If

The report returns multiple records, making the txtReferralDueDate field NOT visible for ALL records even if only one record contains a txtReferralReturnedDate that is Null.

Obviously, I've done something wrong and appreciate any help.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Are you viewing the report in 'Report View' or print preview?

The onformat runs in print preview.

There are a few ways to do what you are looking for in report view, Conditional formatting without code might work for you.
 
Upvote 0
Print preview and print. It's rendering that particular field NOT visible for all records, despite some records meeting the first condition. I'm stumped beyond stumped.
 
Upvote 0
I think access doesn't have nulls as date values, try comparing to 0:

Code:
If NZ(Me.txtReferralReturnedDate) = 0 Then
    Me.txtReferralDueDate.Visible = True
Else
    Me.txtReferralDueDate.Visible = False
End If
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top