Avatar of SteveL13
SteveL13
Flag for United States of America asked on

Query designer expression

What is wrong with this:

Total: =Sum([Amount]) where [EntryDate] between #1/1/2017# and #10/31/2017#
Microsoft Access

Avatar of undefined
Last Comment
SteveL13

8/22/2022 - Mon
Hamed Nasr

Where are you using this statement?
Upload the object using it.

First attempt: remove ':'
What error are you receiving?
SteveL13

ASKER
Am using in a query designer as an expression.  I can't upload due to confidentiality issues.
SOLUTION
Anders Ebro (Microsoft MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Hamed Nasr

I can't upload due to confidentiality issues.
If I want to check, I need to recreate the issue, and not your database.
So I am asking you to recreate the issue with dummy data.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
SteveL13

ASKER
Let me see what I can put together
ASKER CERTIFIED SOLUTION
Gustav Brock

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
PatHartman

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SteveL13

ASKER
I'll get something together tomorrow to show you. I thought this would be easy by if course it isn't.
PatHartman

Gus gave you a suggestion for how to incorporate the date range in the sum but context matters and the expression would be different depending on where you needed to run it.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SteveL13

ASKER
I was able to use Gus' code with modification:

TotalCurrentPeriod: Sum(IIf([PostDate]>=[Forms]![frmSelectDateRange]![txtStartDate] And [PostDate]<=[Forms]![frmSelectDateRange]![txtEndDate],[Amount],0))

But I'm going to award points to all who contributed, because everyone provided insight that really helps me, and start a new topic title "Query Designer Help Please".