Errors with DAvg

D

David McKnight

I'm getting errors when I use the following query statement:

Moving Avg: (DAvg("[Avg Of Valueof]","Table1","Nameof ='" & [Nameof] & "'
AND Season BETWEEN " & [Yearof]-7 & " AND " & [Yearof]-1))

I believe the reason for the errors is because there are some missing
"Years" to do the averaging between year -7 and year -1. Any good way to
handle this? This query statement queries another query so it would be very
difficult to add blanks to the underlining table for the missing years.

Moving Avg: (DAvg("[Avg Of Valueof]","Table1","Nameof ='" & [Nameof] & "'
AND Season BETWEEN " & [Yearof]-7 & " AND " & [Yearof]-1))
 
M

[MVP] S.Clark

If there is no value returned, then it is set to Null. Wrap Nz() around it.

i.e. Nz(expr, 0) or Nz(expr, "")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top