Access report Record SOurce Query Syntax

Although it is uncommon - I need to put a huge query in a record source of a textbox on an access report - is this in the proper syntax?

SELECT Sum([qryPlanner-ProdMethod-WkREPORT].Sales), Sum([qryPlanner-ProdMethod-WkREPORT].Fcst)
FROM [qryPlanner-ProdMethod-WkREPORT]
WHERE ((([qryPlanner-ProdMethod-WkREPORT].WkBeginDate)>=Date()-32)) OR ((([qryPlanner-ProdMethod-WkREPORT].WkBeginDate)<=Date()-6));
dawber39Database Analyst / Application DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dawber39Database Analyst / Application DeveloperAuthor Commented:
Oh - and the query being used in this query - is the report record source
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
1) A Textbox does not have a Record Source, it has a Control Source.
2) You cannot put an SQL statement directly in a Text Box Control Source.

mx
0
dawber39Database Analyst / Application DeveloperAuthor Commented:
That's what I put it in... my bad

Here's the errorErr.png
0
Acronis Data Cloud 7.8 Enhances Cyber Protection

A closer look at five essential enhancements that benefit end-users and help MSPs take their cloud data protection business further.

PatHartmanCommented:
If you are trying to conditionally sum fields from the report's recordsource, you may be able to create two controls in the report footer:
SalesSummary:
= Sum(IIf(WkBeginDate>=Date()-32 OR WkBeginDate<=Date()-6, Sales, 0)

ForecastSummary:
= Sum(IIf(WkBeginDate>=Date()-32 OR WkBeginDate<=Date()-6, Fcst, 0)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"That's what I put it in... my bad"
In what?  
If you mean the Control Source ....
You cannot put an SQL statement directly in a Text Box Control Source.

What you can do in a Control Source is for example ... use DLookup() to extract a *single* value from a Field in a query to display in the Text Box.
0
dawber39Database Analyst / Application DeveloperAuthor Commented:
Excellent as always - Thank you people
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.