Skip to main content
Question

Object reference not set to an instance of an object when trying to filter on date

  • April 14, 2026
  • 6 replies
  • 29 views

dgodsill97
Varsity I
Forum|alt.badge.img+6

I created two subqueries.  One totals the sales booked by order date and the other totals the invoices billed by doc date.  When I add the two subqueries to the main query and try to filter on a date range I get the object reference error.

Booked Query

Invoiced Query

Both are grouping by date, the formula is makes the amount negative if a CM.

Conditions

Main left joins invoiced query to booked query by date.

Without the conditions the data is returned

 

6 replies

darylbowman
Captain II
Forum|alt.badge.img+16

Do you have the conditions on the main or on the subs?


dgodsill97
Varsity I
Forum|alt.badge.img+6
  • Author
  • Varsity I
  • April 14, 2026

yes, for bookings, exclude order type behavior of TR and QT and added OrderDate not empty 

Yes, for invoiced, released and docdate not empty

For main, only the date range conditions.


darylbowman
Captain II
Forum|alt.badge.img+16

Can I see your joins?


dgodsill97
Varsity I
Forum|alt.badge.img+6
  • Author
  • Varsity I
  • April 14, 2026

Even when I just had the booking subquery in the main query it blew up on the date conditions.  If I don’t use the date conditions I can add filters like this month, this quarter, YTD using the start and end dates,

 

 


darylbowman
Captain II
Forum|alt.badge.img+16

I’m afraid I don’t have any ideas 🤔


dgodsill97
Varsity I
Forum|alt.badge.img+6
  • Author
  • Varsity I
  • April 14, 2026

Thanks for trying.