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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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,214,982
Messages
6,122,575
Members
449,089
Latest member
Motoracer88

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