Sum of values in a form

  • Thread starter Pascoe via AccessMonster.com
  • Start date
P

Pascoe via AccessMonster.com

Folks,

I have read numerous threads on this topic, and understand that in order for
my Sum() to work I need to ensure all references are made back to the Record
Source.

I have endeavoured to do this, but am still getting #Error.

I am trying to Sum the revenue each tenant provides in a given date range, to
give a total revenue figure. If the date range is a whole month, then the
expression just takes the value of Rent PCM, and not (Rent PCM*(12/52)) * No.
of Days,
which would give some unusual results.

My Expression looks like this:

=Sum(Nz(IIf([Short Let]=-1,[Rent pcm],IIf(Day([Forms]![Revenue Report]![Start
Date Chosen])=1 And (Day([Forms]![Revenue Report]![End Date Chosen])=Day
(DateSerial(Year([Forms]![Revenue Report]![Start Date Chosen]),Month([Forms]!
[Revenue Report]![Start Date Chosen])+1,0))) And (Month([Forms]![Revenue
Report]![Start Date Chosen])=Month([Forms]![Revenue Report]![End Date Chosen]

)) And (Year([Forms]![Revenue Report]![Start Date Chosen])=Year([Forms]!
[Revenue Report]![End Date Chosen]))=-1 And [Moved In]<=[Forms]![Revenue
Report]![Start Date Chosen] And ([Moved Out]>=[Forms]![Revenue Report]![End
Date Chosen] Or [Moved Out] Is Null),[Rent pcm],DateDiff("d",IIf([Moved In]<=
[Forms]![Revenue Report]![Start Date Chosen],[Forms]![Revenue Report]![Start
Date Chosen],[Moved In]),IIf([Forms]![Revenue Report]![End Date Chosen]>=
[Moved Out] And [Moved Out]>=[Forms]![Revenue Report]![Start Date Chosen],
[Moved Out],[Forms]![Revenue Report]![End Date Chosen]))*([Rent pcm]*(12/365)

)))))

I wonder whether referencing back to another form where I have entered the
dates for the query range (Start Date Chosen and End Date Chosen) are the
current cause of my problem.

Any thoughts gratetfully received.

Kind Regards,
Russell.
 

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