Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Circular Reference" Error when runnig Master Query.

Status
Not open for further replies.

MarcoPerez21

Programmer
May 5, 2004
55
US
Hey guys here's an error I'm receiving when I run my "Master" query: Circular Reference caused by 'qry_salesinput_master' any suggestions and insight would be appreciated.

this is the sql to the query:
Code:
PARAMETERS [Enter Beginning Date] DateTime;
SELECT qry_Master_sample.qry_salesinput_master.Period, qry_Master_sample.qry_salesinput_master.Week, qry_Master_sample.qry_salesinput_day1.Day, qry_Master_sample.qry_salesinput_day1.[Store Am sales], qry_Master_sample.qry_salesinput_day1.[Store Pm sales], qry_Master_sample.qry_salesinput_day1.[Store Praline Sales], qry_Master_sample.qry_salesinput_day1.[Store Merch Sales], qry_Master_sample.qry_salesinput_day1.[Store Postage Sales], qry_Master_sample.qry_salesinput_day1.[MailOrder Praline Sales], qry_Master_sample.qry_salesinput_day1.[MailOrder Merch Sales], qry_Master_sample.qry_salesinput_day1.[MailOrder Postage Sales], qry_Master_sample.qry_salesinput_day1.[MailOrder Total Sales], qry_Master_sample.qry_salesinput_day1.[Wholesale Praline Sales], qry_Master_sample.qry_salesinput_day1.[Wholesale Merch Sales], qry_Master_sample.qry_salesinput_day1.[Wholesale Postage Sales], qry_Master_sample.qry_salesinput_day1.[Wholesale Total Sales], qry_Master_sample.qry_salesinput_day1.[Planned Store hours], qry_Master_sample.qry_salesinput_day1.[Actual Store hours], qry_Master_sample.qry_salesinput_day1.[Planned Store Dollars], qry_Master_sample.qry_salesinput_day1.[Actual Store Dollars], qry_Master_sample.qry_salesinput_day1.[Overtime Dollars], qry_Master_sample.qry_salesinput_day1.[Training Dollars], qry_Master_sample.qry_salesinput_day1.[Am # of Tickets], qry_Master_sample.qry_salesinput_day1.[Pm # of Tickets], qry_Master_sample.qry_salesinput_day1.[Peak Ticket Hour], qry_Master_sample.qry_salesinput_day2.Day, qry_Master_sample.qry_salesinput_day2.[Store Am sales], qry_Master_sample.qry_salesinput_day2.[Store Pm sales], qry_Master_sample.qry_salesinput_day2.[Store Praline Sales], qry_Master_sample.qry_salesinput_day2.[Store Merch Sales], qry_Master_sample.qry_salesinput_day2.[Store Postage Sales], qry_Master_sample.qry_salesinput_day2.[MailOrder Praline Sales], qry_Master_sample.qry_salesinput_day2.[MailOrder Merch Sales], qry_Master_sample.qry_salesinput_day2.[MailOrder Postage Sales], qry_Master_sample.qry_salesinput_day2.[MailOrder Total Sales], qry_Master_sample.qry_salesinput_day2.[Wholesale Praline Sales], qry_Master_sample.qry_salesinput_day2.[Wholesale Merch Sales], qry_Master_sample.qry_salesinput_day2.[Wholesale Postage Sales], qry_Master_sample.qry_salesinput_day2.[Wholesale Total Sales], qry_Master_sample.qry_salesinput_day2.[Planned Store hours], qry_Master_sample.qry_salesinput_day2.[Actual Store hours], qry_Master_sample.qry_salesinput_day2.[Planned Store Dollars], qry_Master_sample.qry_salesinput_day2.[Actual Store Dollars], qry_Master_sample.qry_salesinput_day2.[Overtime Dollars], qry_Master_sample.qry_salesinput_day2.[Training Dollars], qry_Master_sample.qry_salesinput_day2.[Am # of Tickets], qry_Master_sample.qry_salesinput_day2.[Pm # of Tickets], qry_Master_sample.qry_salesinput_day2.[Peak Ticket Hour], qry_Master_sample.qry_salesinput_day3.Day, qry_Master_sample.qry_salesinput_day3.[Store Am sales], qry_Master_sample.qry_salesinput_day3.[Store Pm sales], qry_Master_sample.qry_salesinput_day3.[Store Praline Sales], qry_Master_sample.qry_salesinput_day3.[Store Merch Sales], qry_Master_sample.qry_salesinput_day3.[Store Postage Sales], qry_Master_sample.qry_salesinput_day3.[MailOrder Praline Sales], qry_Master_sample.qry_salesinput_day3.[MailOrder Merch Sales], qry_Master_sample.qry_salesinput_day3.[MailOrder Postage Sales], qry_Master_sample.qry_salesinput_day3.[MailOrder Total Sales], qry_Master_sample.qry_salesinput_day3.[Wholesale Praline Sales], qry_Master_sample.qry_salesinput_day3.[Wholesale Merch Sales], qry_Master_sample.qry_salesinput_day3.[Wholesale Postage Sales], qry_Master_sample.qry_salesinput_day3.[Wholesale Total Sales], qry_Master_sample.qry_salesinput_day3.[Planned Store hours], qry_Master_sample.qry_salesinput_day3.[Actual Store hours], qry_Master_sample.qry_salesinput_day3.[Planned Store Dollars], qry_Master_sample.qry_salesinput_day3.[Actual Store Dollars], qry_Master_sample.qry_salesinput_day3.[Overtime Dollars], qry_Master_sample.qry_salesinput_day3.[Training Dollars], qry_Master_sample.qry_salesinput_day3.[Am # of Tickets], qry_Master_sample.qry_salesinput_day3.[Pm # of Tickets], qry_Master_sample.qry_salesinput_day3.[Peak Ticket Hour], qry_Master_sample.qry_salesinput_day4.Day, qry_Master_sample.qry_salesinput_day4.[Store Am sales], qry_Master_sample.qry_salesinput_day4.[Store Pm sales], qry_Master_sample.qry_salesinput_day4.[Store Praline Sales], qry_Master_sample.qry_salesinput_day4.[Store Merch Sales], qry_Master_sample.qry_salesinput_day4.[Store Postage Sales], qry_Master_sample.qry_salesinput_day4.[MailOrder Praline Sales], qry_Master_sample.qry_salesinput_day4.[MailOrder Merch Sales], qry_Master_sample.qry_salesinput_day4.[MailOrder Postage Sales], qry_Master_sample.qry_salesinput_day4.[Wholesale Praline Sales], qry_Master_sample.qry_salesinput_day4.[MailOrder Total Sales], qry_Master_sample.qry_salesinput_day4.[Wholesale Merch Sales], qry_Master_sample.qry_salesinput_day4.[Wholesale Postage Sales], qry_Master_sample.qry_salesinput_day4.[Wholesale Total Sales], qry_Master_sample.qry_salesinput_day4.[Planned Store hours], qry_Master_sample.qry_salesinput_day4.[Actual Store hours], qry_Master_sample.qry_salesinput_day4.[Planned Store Dollars], qry_Master_sample.qry_salesinput_day4.[Actual Store Dollars], qry_Master_sample.qry_salesinput_day4.[Overtime Dollars], qry_Master_sample.qry_salesinput_day4.[Training Dollars], qry_Master_sample.qry_salesinput_day4.[Am # of Tickets], qry_Master_sample.qry_salesinput_day4.[Pm # of Tickets], qry_Master_sample.qry_salesinput_day4.[Peak Ticket Hour], qry_Master_sample.qry_salesinput_day5.Day, qry_Master_sample.qry_salesinput_day5.[Store Am sales], qry_Master_sample.qry_salesinput_day5.[Store Pm sales], qry_Master_sample.qry_salesinput_day5.[Store Praline Sales], qry_Master_sample.qry_salesinput_day5.[Store Merch Sales], qry_Master_sample.qry_salesinput_day5.[Store Postage Sales], qry_Master_sample.qry_salesinput_day5.[MailOrder Praline Sales], qry_Master_sample.qry_salesinput_day5.[MailOrder Merch Sales], qry_Master_sample.qry_salesinput_day5.[MailOrder Postage Sales], qry_Master_sample.qry_salesinput_day5.[MailOrder Total Sales], qry_Master_sample.qry_salesinput_day5.[Wholesale Praline Sales], qry_Master_sample.qry_salesinput_day5.[Wholesale Merch Sales], qry_Master_sample.qry_salesinput_day5.[Wholesale Postage Sales], qry_Master_sample.qry_salesinput_day5.[Wholesale Total Sales], qry_Master_sample.qry_salesinput_day5.[Planned Store hours], qry_Master_sample.qry_salesinput_day5.[Actual Store hours], qry_Master_sample.qry_salesinput_day5.[Planned Store Dollars], qry_Master_sample.qry_salesinput_day5.[Actual Store Dollars], qry_Master_sample.qry_salesinput_day5.[Overtime Dollars], qry_Master_sample.qry_salesinput_day5.[Training Dollars], qry_Master_sample.qry_salesinput_day5.[Am # of Tickets], qry_Master_sample.qry_salesinput_day5.[Pm # of Tickets], qry_Master_sample.qry_salesinput_day5.[Peak Ticket Hour], qry_Master_sample.qry_salesinput_day6.Day, qry_Master_sample.qry_salesinput_day6.[Store Am sales], qry_Master_sample.qry_salesinput_day6.[Store Pm sales], qry_Master_sample.qry_salesinput_day6.[Store Praline Sales], qry_Master_sample.qry_salesinput_day6.[Store Merch Sales], qry_Master_sample.qry_salesinput_day6.[Store Postage Sales], qry_Master_sample.qry_salesinput_day6.[MailOrder Praline Sales], qry_Master_sample.qry_salesinput_day6.[MailOrder Merch Sales], qry_Master_sample.qry_salesinput_day6.[MailOrder Postage Sales], qry_Master_sample.qry_salesinput_day6.[MailOrder Total Sales], qry_Master_sample.qry_salesinput_day6.[Wholesale Praline Sales], qry_Master_sample.qry_salesinput_day6.[Wholesale Merch Sales], qry_Master_sample.Expr1129, qry_Master_sample.qry_salesinput_day6.[Wholesale Postage Sales], qry_Master_sample.qry_salesinput_day6.[Planned Store hours], qry_Master_sample.qry_salesinput_day6.[Actual Store hours], qry_Master_sample.qry_salesinput_day6.[Planned Store Dollars], qry_Master_sample.qry_salesinput_day6.[Actual Store Dollars], qry_Master_sample.qry_salesinput_day6.[Overtime Dollars], qry_Master_sample.qry_salesinput_day6.[Training Dollars], qry_Master_sample.qry_salesinput_day6.[Am # of Tickets], qry_Master_sample.qry_salesinput_day6.[Pm # of Tickets], qry_Master_sample.qry_salesinput_day6.[Peak Ticket Hour], qry_Master_sample.qry_salesinput_day7.Day, qry_Master_sample.qry_salesinput_day7.[Store Am sales], qry_Master_sample.qry_salesinput_day7.[Store Pm sales], qry_Master_sample.qry_salesinput_day7.[Store Praline Sales], qry_Master_sample.qry_salesinput_day7.[Store Merch Sales], qry_Master_sample.qry_salesinput_day7.[Store Postage Sales], qry_Master_sample.qry_salesinput_day7.[MailOrder Praline Sales], qry_Master_sample.qry_salesinput_day7.[MailOrder Merch Sales], qry_Master_sample.qry_salesinput_day7.[MailOrder Postage Sales], qry_Master_sample.qry_salesinput_day7.[MailOrder Total Sales], qry_Master_sample.qry_salesinput_day7.[Wholesale Praline Sales], qry_Master_sample.qry_salesinput_day7.[Wholesale Merch Sales], qry_Master_sample.qry_salesinput_day7.[Wholesale Postage Sales], qry_Master_sample.qry_salesinput_day7.[Wholesale Total Sales], qry_Master_sample.qry_salesinput_day7.[Planned Store hours], qry_Master_sample.qry_salesinput_day7.[Actual Store hours], qry_Master_sample.qry_salesinput_day7.[Planned Store Dollars], qry_Master_sample.qry_salesinput_day7.[Actual Store Dollars], qry_Master_sample.qry_salesinput_day7.[Overtime Dollars], qry_Master_sample.qry_salesinput_day7.[Training Dollars], qry_Master_sample.qry_salesinput_day7.[Am # of Tickets], qry_Master_sample.qry_salesinput_day7.[Pm # of Tickets], qry_Master_sample.qry_salesinput_day7.[Peak Ticket Hour], qry_Master_sample.Qry_LYsalesinput_Master.Period, qry_Master_sample.Qry_LYsalesinput_Master.Week, qry_Master_sample.qry_LYsalesinput_day1.Day, qry_Master_sample.qry_LYsalesinput_day1.[Store Am sales], qry_Master_sample.qry_LYsalesinput_day1.[Store Pm sales], qry_Master_sample.qry_LYsalesinput_day1.[MailOrder Total Sales], qry_Master_sample.qry_LYsalesinput_day1.[Wholesale Total Sales], qry_Master_sample.qry_LYsalesinput_day1.[Am # of Tickets], qry_Master_sample.qry_LYsalesinput_day1.[Pm # of Tickets], qry_Master_sample.qry_LYsalesinput_day2.Day, qry_Master_sample.qry_LYsalesinput_day2.[Store Am sales], qry_Master_sample.qry_LYsalesinput_day2.[Store Pm sales], qry_Master_sample.qry_LYsalesinput_day2.[MailOrder Total Sales], qry_Master_sample.qry_LYsalesinput_day2.[Wholesale Total Sales], qry_Master_sample.qry_LYsalesinput_day2.[Am # of Tickets], qry_Master_sample.qry_LYsalesinput_day2.[Pm # of Tickets], qry_Master_sample.qry_LYsalesinput_day3.Day, qry_Master_sample.qry_LYsalesinput_day3.[Store Am sales], qry_Master_sample.qry_LYsalesinput_day3.[Store Pm sales], qry_Master_sample.qry_LYsalesinput_day3.[MailOrder Total Sales], qry_Master_sample.qry_LYsalesinput_day3.[Wholesale Total Sales], qry_Master_sample.qry_LYsalesinput_day3.[Am # of Tickets], qry_Master_sample.qry_LYsalesinput_day3.[Pm # of Tickets], qry_Master_sample.qry_LYsalesinput_day4.Day, qry_Master_sample.qry_LYsalesinput_day4.[Store Am sales], qry_Master_sample.qry_LYsalesinput_day4.[Store Pm sales], qry_Master_sample.qry_LYsalesinput_day4.[MailOrder Total Sales], qry_Master_sample.qry_LYsalesinput_day4.[Wholesale Total Sales], qry_Master_sample.qry_LYsalesinput_day4.[Am # of Tickets], qry_Master_sample.qry_LYsalesinput_day4.[Pm # of Tickets], qry_Master_sample.qry_LYsalesinput_day5.Day, qry_Master_sample.qry_LYsalesinput_day5.[Store Am sales], qry_Master_sample.qry_LYsalesinput_day5.[Store Pm sales], qry_Master_sample.qry_LYsalesinput_day5.[MailOrder Total Sales], qry_Master_sample.qry_LYsalesinput_day5.[Wholesale Total Sales], qry_Master_sample.qry_LYsalesinput_day5.[Am # of Tickets], qry_Master_sample.qry_LYsalesinput_day5.[Pm # of Tickets], qry_Master_sample.qry_LYsalesinput_day6.Day, qry_Master_sample.qry_LYsalesinput_day6.[Store Am sales], qry_Master_sample.qry_LYsalesinput_day6.[Store Pm sales], qry_Master_sample.qry_LYsalesinput_day6.[MailOrder Total Sales], qry_Master_sample.qry_LYsalesinput_day6.[Wholesale Total Sales], qry_Master_sample.qry_LYsalesinput_day6.[Am # of Tickets], qry_Master_sample.qry_LYsalesinput_day6.[Pm # of Tickets], qry_Master_sample.qry_LYsalesinput_day7.Day, qry_Master_sample.qry_LYsalesinput_day7.[Store Am sales], qry_Master_sample.qry_LYsalesinput_day7.[Store Pm sales], qry_Master_sample.qry_LYsalesinput_day7.[MailOrder Total Sales], qry_Master_sample.qry_LYsalesinput_day7.[Wholesale Total Sales], qry_Master_sample.qry_LYsalesinput_day7.[Am # of Tickets], qry_Master_sample.qry_LYsalesinput_day7.[Pm # of Tickets]
FROM qry_Master_sample;>
I'm stumped and pulling my hair out.
Marco
[hairpull]
 
If you are pulling all this information from a single query result set : qry_Master_sample
what are all the references to all the other queries?

qry_Master_sample.qry_LYsalesinput_day7.[Pm # of Tickets]
QueryName QueryName? FieldName



Leslie
 
Holy enormous query Batman!!!!

What query is your date field coming from?

Make sure to include the date field in your query result.

Also, try including your date parameter in a where clause.

Select................from qry_Master_sample WHERE qrythathasdatefield.NameofYourDateField = [Enter Beginning Date]

Change qrythathasdatefield.NameofYourDateField to be applicable to your program.

Hope this helps.

 
Given the message "Circular Reference", I would ensure that none of your "secondary queries" (qry_salesinput_day1, qry_salesinput_day2, ...) refer back to qry_Master_sample.


Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Leslie,
the references to the other queries are where I get the totals for the master query.

I took 2 different mastger queries and combined them into the Sample master query.... when I did that I started to get the error of "Circular reference"

cghoga,
I'm fairly new to access, really have no idea where to begin to input that information, can you give me a sample line of code?

thanks,
Marco
[ponder]
 
Ok,

I have a query that gets some information that I have saved as qryData1

I have another query that gets different information that I saved as qryData2


If I want to create a third query combining that data I would do:

SELECT qryData1.Field1, qryData1.Field2, qryData2.Field1, qryData2.Feild2
FROM qryData1
INNER JOIN qryData2 on qryData2.Field3 = qryData1.Field3

There has to be some field in both qryData1 and qryData2 that can be joined, but the naming you have above with QueryName.QueryName[FieldName] probably isn't going to work.

What are the two different master queries that you combined into the SampleMasterQuery. Is this query above the SampleMasterQuery?



Leslie
 
Leslie,

Yes the query above is the sample master query.... I have these two queries that I joined in "sample master"
qry_LYsalesinput_master & qry_Salesinput_Master
these two queries have seperate queries that make them up(them being the master)
I have salesinput.day1 through salesinput.day7 each query gathers the data for each day in a week. Each inidividual query has a "enter begin date" parameter.
I also have LYsalesinput.day1 through LYsalesinput.day7 same criteria as above but i have included expressions to look at a table called "period" which in turn gives me the week/ period information for the previous year.
I know that this is not normalized, but I am just following instructions from my employer.... not a database savvy person....only understands COBOL programming structures. go figure.

thnx,
Marco
 
The problem is a "Circular Reference." Could you post the code, the actual SQL statements, for the following queries:

qry_Master_sample
qry_salesinput_day1
qry_salesinput_master
Qry_LYsalesinput_Master
qry_LYsalesinput_day1

and the expression used to determine the value of : Expr1129

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
the master sample statements are posted already
but I can post them again.

the code for qry_master_sample
Code:
[blue]
SELECT qry_salesinput_master.Period, qry_salesinput_master.Week, qry_salesinput_master.qry_salesinput_day1.Day, qry_salesinput_master.qry_salesinput_day1.[Store Am sales], qry_salesinput_master.qry_salesinput_day1.[Store Pm sales], qry_salesinput_master.qry_salesinput_day1.[Store Praline Sales], qry_salesinput_master.qry_salesinput_day1.[Store Merch Sales], qry_salesinput_master.qry_salesinput_day1.[Store Postage Sales], qry_salesinput_master.qry_salesinput_day1.[MailOrder Praline Sales], qry_salesinput_master.qry_salesinput_day1.[MailOrder Merch Sales], qry_salesinput_master.qry_salesinput_day1.[MailOrder Postage Sales], qry_salesinput_master.qry_salesinput_day1.[MailOrder Total Sales], qry_salesinput_master.qry_salesinput_day1.[Wholesale Praline Sales], qry_salesinput_master.qry_salesinput_day1.[Wholesale Merch Sales], qry_salesinput_master.qry_salesinput_day1.[Wholesale Postage Sales], qry_salesinput_master.qry_salesinput_day1.[Wholesale Total Sales], qry_salesinput_master.qry_salesinput_day1.[Planned Store hours], qry_salesinput_master.qry_salesinput_day1.[Actual Store hours], qry_salesinput_master.qry_salesinput_day1.[Planned Store Dollars], qry_salesinput_master.qry_salesinput_day1.[Actual Store Dollars], qry_salesinput_master.qry_salesinput_day1.[Overtime Dollars], qry_salesinput_master.qry_salesinput_day1.[Training Dollars], qry_salesinput_master.qry_salesinput_day1.[Am # of Tickets], qry_salesinput_master.qry_salesinput_day1.[Pm # of Tickets], qry_salesinput_master.qry_salesinput_day1.[Peak Ticket Hour], qry_salesinput_master.qry_salesinput_day2.Day, qry_salesinput_master.qry_salesinput_day2.[Store Am sales], qry_salesinput_master.qry_salesinput_day2.[Store Pm sales], qry_salesinput_master.qry_salesinput_day2.[Store Praline Sales], qry_salesinput_master.qry_salesinput_day2.[Store Merch Sales], qry_salesinput_master.qry_salesinput_day2.[Store Postage Sales], qry_salesinput_master.qry_salesinput_day2.[MailOrder Praline Sales], qry_salesinput_master.qry_salesinput_day2.[MailOrder Merch Sales], qry_salesinput_master.qry_salesinput_day2.[MailOrder Postage Sales], qry_salesinput_master.qry_salesinput_day2.[MailOrder Total Sales], qry_salesinput_master.qry_salesinput_day2.[Wholesale Praline Sales], qry_salesinput_master.qry_salesinput_day2.[Wholesale Merch Sales], qry_salesinput_master.qry_salesinput_day2.[Wholesale Postage Sales], qry_salesinput_master.qry_salesinput_day2.[Wholesale Total Sales], qry_salesinput_master.qry_salesinput_day2.[Planned Store hours], qry_salesinput_master.qry_salesinput_day2.[Actual Store hours], qry_salesinput_master.qry_salesinput_day2.[Planned Store Dollars], qry_salesinput_master.qry_salesinput_day2.[Actual Store Dollars], qry_salesinput_master.qry_salesinput_day2.[Overtime Dollars], qry_salesinput_master.qry_salesinput_day2.[Training Dollars], qry_salesinput_master.qry_salesinput_day2.[Am # of Tickets], qry_salesinput_master.qry_salesinput_day2.[Pm # of Tickets], qry_salesinput_master.qry_salesinput_day2.[Peak Ticket Hour], qry_salesinput_master.qry_salesinput_day3.Day, qry_salesinput_master.qry_salesinput_day3.[Store Am sales], qry_salesinput_master.qry_salesinput_day3.[Store Pm sales], qry_salesinput_master.qry_salesinput_day3.[Store Praline Sales], qry_salesinput_master.qry_salesinput_day3.[Store Merch Sales], qry_salesinput_master.qry_salesinput_day3.[Store Postage Sales], qry_salesinput_master.qry_salesinput_day3.[MailOrder Praline Sales], qry_salesinput_master.qry_salesinput_day3.[MailOrder Merch Sales], qry_salesinput_master.qry_salesinput_day3.[MailOrder Postage Sales], qry_salesinput_master.qry_salesinput_day3.[MailOrder Total Sales], qry_salesinput_master.qry_salesinput_day3.[Wholesale Praline Sales], qry_salesinput_master.qry_salesinput_day3.[Wholesale Merch Sales], qry_salesinput_master.qry_salesinput_day3.[Wholesale Postage Sales], qry_salesinput_master.qry_salesinput_day3.[Wholesale Total Sales], qry_salesinput_master.qry_salesinput_day3.[Planned Store hours], qry_salesinput_master.qry_salesinput_day3.[Actual Store hours], qry_salesinput_master.qry_salesinput_day3.[Planned Store Dollars], qry_salesinput_master.qry_salesinput_day3.[Actual Store Dollars], qry_salesinput_master.qry_salesinput_day3.[Overtime Dollars], qry_salesinput_master.qry_salesinput_day3.[Training Dollars], qry_salesinput_master.qry_salesinput_day3.[Am # of Tickets], qry_salesinput_master.qry_salesinput_day3.[Pm # of Tickets], qry_salesinput_master.qry_salesinput_day3.[Peak Ticket Hour], qry_salesinput_master.qry_salesinput_day4.Day, qry_salesinput_master.qry_salesinput_day4.[Store Am sales], qry_salesinput_master.qry_salesinput_day4.[Store Pm sales], qry_salesinput_master.qry_salesinput_day4.[Store Praline Sales], qry_salesinput_master.qry_salesinput_day4.[Store Merch Sales], qry_salesinput_master.qry_salesinput_day4.[Store Postage Sales], qry_salesinput_master.qry_salesinput_day4.[MailOrder Praline Sales], qry_salesinput_master.qry_salesinput_day4.[MailOrder Merch Sales], qry_salesinput_master.qry_salesinput_day4.[MailOrder Postage Sales], qry_salesinput_master.qry_salesinput_day4.[Wholesale Praline Sales], qry_salesinput_master.qry_salesinput_day4.[MailOrder Total Sales], qry_salesinput_master.qry_salesinput_day4.[Wholesale Merch Sales], qry_salesinput_master.qry_salesinput_day4.[Wholesale Postage Sales], qry_salesinput_master.qry_salesinput_day4.[Wholesale Total Sales], qry_salesinput_master.qry_salesinput_day4.[Planned Store hours], qry_salesinput_master.qry_salesinput_day4.[Actual Store hours], qry_salesinput_master.qry_salesinput_day4.[Planned Store Dollars], qry_salesinput_master.qry_salesinput_day4.[Actual Store Dollars], qry_salesinput_master.qry_salesinput_day4.[Overtime Dollars], qry_salesinput_master.qry_salesinput_day4.[Training Dollars], qry_salesinput_master.qry_salesinput_day4.[Am # of Tickets], qry_salesinput_master.qry_salesinput_day4.[Pm # of Tickets], qry_salesinput_master.qry_salesinput_day4.[Peak Ticket Hour], qry_salesinput_master.qry_salesinput_day5.Day, qry_salesinput_master.qry_salesinput_day5.[Store Am sales], qry_salesinput_master.qry_salesinput_day5.[Store Pm sales], qry_salesinput_master.qry_salesinput_day5.[Store Praline Sales], qry_salesinput_master.qry_salesinput_day5.[Store Merch Sales], qry_salesinput_master.qry_salesinput_day5.[Store Postage Sales], qry_salesinput_master.qry_salesinput_day5.[MailOrder Praline Sales], qry_salesinput_master.qry_salesinput_day5.[MailOrder Merch Sales], qry_salesinput_master.qry_salesinput_day5.[MailOrder Postage Sales], qry_salesinput_master.qry_salesinput_day5.[MailOrder Total Sales], qry_salesinput_master.qry_salesinput_day5.[Wholesale Praline Sales], qry_salesinput_master.qry_salesinput_day5.[Wholesale Merch Sales], qry_salesinput_master.qry_salesinput_day5.[Wholesale Postage Sales], qry_salesinput_master.qry_salesinput_day5.[Wholesale Total Sales], qry_salesinput_master.qry_salesinput_day5.[Planned Store hours], qry_salesinput_master.qry_salesinput_day5.[Actual Store hours], qry_salesinput_master.qry_salesinput_day5.[Planned Store Dollars], qry_salesinput_master.qry_salesinput_day5.[Actual Store Dollars], qry_salesinput_master.qry_salesinput_day5.[Overtime Dollars], qry_salesinput_master.qry_salesinput_day5.[Training Dollars], qry_salesinput_master.qry_salesinput_day5.[Am # of Tickets], qry_salesinput_master.qry_salesinput_day5.[Pm # of Tickets], qry_salesinput_master.qry_salesinput_day5.[Peak Ticket Hour], qry_salesinput_master.qry_salesinput_day6.Day, qry_salesinput_master.qry_salesinput_day6.[Store Am sales], qry_salesinput_master.qry_salesinput_day6.[Store Pm sales], qry_salesinput_master.qry_salesinput_day6.[Store Praline Sales], qry_salesinput_master.qry_salesinput_day6.[Store Merch Sales], qry_salesinput_master.qry_salesinput_day6.[Store Postage Sales], qry_salesinput_master.qry_salesinput_day6.[MailOrder Praline Sales], qry_salesinput_master.qry_salesinput_day6.[MailOrder Merch Sales], qry_salesinput_master.qry_salesinput_day6.[MailOrder Postage Sales], qry_salesinput_master.qry_salesinput_day6.[MailOrder Total Sales], qry_salesinput_master.qry_salesinput_day6.[Wholesale Praline Sales], qry_salesinput_master.qry_salesinput_day6.[Wholesale Merch Sales], qry_salesinput_master.Expr1129, qry_salesinput_master.qry_salesinput_day6.[Wholesale Postage Sales], qry_salesinput_master.qry_salesinput_day6.[Planned Store hours], qry_salesinput_master.qry_salesinput_day6.[Actual Store hours], qry_salesinput_master.qry_salesinput_day6.[Planned Store Dollars], qry_salesinput_master.qry_salesinput_day6.[Actual Store Dollars], qry_salesinput_master.qry_salesinput_day6.[Overtime Dollars], qry_salesinput_master.qry_salesinput_day6.[Training Dollars], qry_salesinput_master.qry_salesinput_day6.[Am # of Tickets], qry_salesinput_master.qry_salesinput_day6.[Pm # of Tickets], qry_salesinput_master.qry_salesinput_day6.[Peak Ticket Hour], qry_salesinput_master.qry_salesinput_day7.Day, qry_salesinput_master.qry_salesinput_day7.[Store Am sales], qry_salesinput_master.qry_salesinput_day7.[Store Pm sales], qry_salesinput_master.qry_salesinput_day7.[Store Praline Sales], qry_salesinput_master.qry_salesinput_day7.[Store Merch Sales], qry_salesinput_master.qry_salesinput_day7.[Store Postage Sales], qry_salesinput_master.qry_salesinput_day7.[MailOrder Praline Sales], qry_salesinput_master.qry_salesinput_day7.[MailOrder Merch Sales], qry_salesinput_master.qry_salesinput_day7.[MailOrder Postage Sales], qry_salesinput_master.qry_salesinput_day7.[MailOrder Total Sales], qry_salesinput_master.qry_salesinput_day7.[Wholesale Praline Sales], qry_salesinput_master.qry_salesinput_day7.[Wholesale Merch Sales], qry_salesinput_master.qry_salesinput_day7.[Wholesale Postage Sales], qry_salesinput_master.qry_salesinput_day7.[Wholesale Total Sales], qry_salesinput_master.qry_salesinput_day7.[Planned Store hours], qry_salesinput_master.qry_salesinput_day7.[Actual Store hours], qry_salesinput_master.qry_salesinput_day7.[Planned Store Dollars], qry_salesinput_master.qry_salesinput_day7.[Actual Store Dollars], qry_salesinput_master.qry_salesinput_day7.[Overtime Dollars], qry_salesinput_master.qry_salesinput_day7.[Training Dollars], qry_salesinput_master.qry_salesinput_day7.[Am # of Tickets], qry_salesinput_master.qry_salesinput_day7.[Pm # of Tickets], qry_salesinput_master.qry_salesinput_day7.[Peak Ticket Hour], Qry_LYsalesinput_Master.Period, Qry_LYsalesinput_Master.Week, Qry_LYsalesinput_Master.qry_LYsalesinput_day1.Day, Qry_LYsalesinput_Master.qry_LYsalesinput_day1.[Store Am sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day1.[Store Pm sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day1.[MailOrder Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day1.[Wholesale Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day1.[Am # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day1.[Pm # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day2.Day, Qry_LYsalesinput_Master.qry_LYsalesinput_day2.[Store Am sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day2.[Store Pm sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day2.[MailOrder Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day2.[Wholesale Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day2.[Am # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day2.[Pm # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day3.Day, Qry_LYsalesinput_Master.qry_LYsalesinput_day3.[Store Am sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day3.[Store Pm sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day3.[MailOrder Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day3.[Wholesale Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day3.[Am # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day3.[Pm # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day4.Day, Qry_LYsalesinput_Master.qry_LYsalesinput_day4.[Store Am sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day4.[Store Pm sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day4.[MailOrder Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day4.[Wholesale Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day4.[Am # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day4.[Pm # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day5.Day, Qry_LYsalesinput_Master.qry_LYsalesinput_day5.[Store Am sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day5.[Store Pm sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day5.[MailOrder Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day5.[Wholesale Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day5.[Am # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day5.[Pm # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day6.Day, Qry_LYsalesinput_Master.qry_LYsalesinput_day6.[Store Am sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day6.[Store Pm sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day6.[MailOrder Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day6.[Wholesale Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day6.[Am # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day6.[Pm # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day7.Day, Qry_LYsalesinput_Master.qry_LYsalesinput_day7.[Store Am sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day7.[Store Pm sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day7.[MailOrder Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day7.[Wholesale Total Sales], Qry_LYsalesinput_Master.qry_LYsalesinput_day7.[Am # of Tickets], Qry_LYsalesinput_Master.qry_LYsalesinput_day7.[Pm # of Tickets]
FROM Qry_LYsalesinput_Master, qry_salesinput_master;
[/blue]
The sql for qry_salesinput_day1
Code:
[red]
PARAMETERS [Enter Beginning Date] DateTime;
SELECT [tbl_des1_daily sales].Period, [tbl_des1_daily sales].Week, [tbl_des1_daily sales].Day, [tbl_des1_daily sales].[Store Am sales], [tbl_des1_daily sales].[Store Pm sales], [tbl_des1_daily sales].[Store Praline Sales], [tbl_des1_daily sales].[Store Merch Sales], [tbl_des1_daily sales].[Store Postage Sales], [tbl_des1_daily sales].[MailOrder Praline Sales], [tbl_des1_daily sales].[MailOrder Merch Sales], [tbl_des1_daily sales].[MailOrder Postage Sales], [MailOrder Praline Sales]+[MailOrder Merch Sales]+[MailOrder Postage Sales] AS [MailOrder Total Sales], [tbl_des1_daily sales].[Wholesale Praline Sales], [tbl_des1_daily sales].[Wholesale Merch Sales], [tbl_des1_daily sales].[Wholesale Postage Sales], [Wholesale Praline Sales]+[Wholesale Merch Sales]+[Wholesale Postage Sales] AS [WholeSale Total sales], [tbl_des1_daily sales].[Planned Store hours], [tbl_des1_daily sales].[Actual Store hours], [tbl_des1_daily sales].[Planned Store Dollars], [tbl_des1_daily sales].[Actual Store Dollars], [tbl_des1_daily sales].[Overtime Dollars], [tbl_des1_daily sales].[Training Dollars], [tbl_des1_daily sales].[Am # of Tickets], [tbl_des1_daily sales].[Pm # of Tickets], [tbl_des1_daily sales].[Peak Ticket Hour]
FROM [tbl_des1_daily sales]
WHERE ((([tbl_des1_daily sales].Day)=[Enter Beginning Date]))
ORDER BY [tbl_des1_daily sales].Period, [tbl_des1_daily sales].Week, [tbl_des1_daily sales].Day;
[/red]
the sql code for qry_salesinput_master
Code:
[green]
PARAMETERS [Enter Beginning Date] DateTime;
SELECT qry_salesinput_day1.Period, qry_salesinput_day1.Week, qry_salesinput_day1.Day, qry_salesinput_day1.[Store Am sales], qry_salesinput_day1.[Store Pm sales], qry_salesinput_day1.[Store Praline Sales], qry_salesinput_day1.[Store Merch Sales], qry_salesinput_day1.[Store Postage Sales], qry_salesinput_day1.[MailOrder Praline Sales], qry_salesinput_day1.[MailOrder Merch Sales], qry_salesinput_day1.[MailOrder Postage Sales], qry_salesinput_day1.[MailOrder Total Sales], qry_salesinput_day1.[Wholesale Praline Sales], qry_salesinput_day1.[Wholesale Merch Sales], qry_salesinput_day1.[Wholesale Postage Sales], qry_salesinput_day1.[WholeSale Total sales], qry_salesinput_day1.[Planned Store hours], qry_salesinput_day1.[Actual Store hours], qry_salesinput_day1.[Planned Store Dollars], qry_salesinput_day1.[Actual Store Dollars], qry_salesinput_day1.[Overtime Dollars], qry_salesinput_day1.[Training Dollars], qry_salesinput_day1.[Am # of Tickets], qry_salesinput_day1.[Pm # of Tickets], qry_salesinput_day1.[Peak Ticket Hour], qry_salesinput_day2.Day, qry_salesinput_day2.[Store Am sales], qry_salesinput_day2.[Store Pm sales], qry_salesinput_day2.[Store Praline Sales], qry_salesinput_day2.[Store Merch Sales], qry_salesinput_day2.[Store Postage Sales], qry_salesinput_day2.[MailOrder Praline Sales], qry_salesinput_day2.[MailOrder Merch Sales], qry_salesinput_day2.[MailOrder Postage Sales], qry_salesinput_day2.[MailOrder Total Sales], qry_salesinput_day2.[Wholesale Praline Sales], qry_salesinput_day2.[Wholesale Merch Sales], qry_salesinput_day2.[Wholesale Postage Sales], qry_salesinput_day2.[Wholesale Total Sales], qry_salesinput_day2.[Planned Store hours], qry_salesinput_day2.[Actual Store hours], qry_salesinput_day2.[Planned Store Dollars], qry_salesinput_day2.[Actual Store Dollars], qry_salesinput_day2.[Overtime Dollars], qry_salesinput_day2.[Training Dollars], qry_salesinput_day2.[Am # of Tickets], qry_salesinput_day2.[Pm # of Tickets], qry_salesinput_day2.[Peak Ticket Hour], qry_salesinput_day3.Day, qry_salesinput_day3.[Store Am sales], qry_salesinput_day3.[Store Pm sales], qry_salesinput_day3.[Store Praline Sales], qry_salesinput_day3.[Store Merch Sales], qry_salesinput_day3.[Store Postage Sales], qry_salesinput_day3.[MailOrder Praline Sales], qry_salesinput_day3.[MailOrder Merch Sales], qry_salesinput_day3.[MailOrder Postage Sales], qry_salesinput_day3.[MailOrder Total Sales], qry_salesinput_day3.[Wholesale Praline Sales], qry_salesinput_day3.[Wholesale Merch Sales], qry_salesinput_day3.[Wholesale Postage Sales], qry_salesinput_day3.[Wholesale Total Sales], qry_salesinput_day3.[Planned Store hours], qry_salesinput_day3.[Actual Store hours], qry_salesinput_day3.[Planned Store Dollars], qry_salesinput_day3.[Actual Store Dollars], qry_salesinput_day3.[Overtime Dollars], qry_salesinput_day3.[Training Dollars], qry_salesinput_day3.[Am # of Tickets], qry_salesinput_day3.[Pm # of Tickets], qry_salesinput_day3.[Peak Ticket Hour], qry_salesinput_day4.Day, qry_salesinput_day4.[Store Am sales], qry_salesinput_day4.[Store Pm sales], qry_salesinput_day4.[Store Praline Sales], qry_salesinput_day4.[Store Merch Sales], qry_salesinput_day4.[Store Postage Sales], qry_salesinput_day4.[MailOrder Praline Sales], qry_salesinput_day4.[MailOrder Merch Sales], qry_salesinput_day4.[MailOrder Postage Sales], qry_salesinput_day4.[Wholesale Praline Sales], qry_salesinput_day4.[MailOrder Total Sales], qry_salesinput_day4.[Wholesale Merch Sales], qry_salesinput_day4.[Wholesale Postage Sales], qry_salesinput_day4.[Wholesale Total Sales], qry_salesinput_day4.[Planned Store hours], qry_salesinput_day4.[Actual Store hours], qry_salesinput_day4.[Planned Store Dollars], qry_salesinput_day4.[Actual Store Dollars], qry_salesinput_day4.[Overtime Dollars], qry_salesinput_day4.[Training Dollars], qry_salesinput_day4.[Am # of Tickets], qry_salesinput_day4.[Pm # of Tickets], qry_salesinput_day4.[Peak Ticket Hour], qry_salesinput_day5.Day, qry_salesinput_day5.[Store Am sales], qry_salesinput_day5.[Store Pm sales], qry_salesinput_day5.[Store Praline Sales], qry_salesinput_day5.[Store Merch Sales], qry_salesinput_day5.[Store Postage Sales], qry_salesinput_day5.[MailOrder Praline Sales], qry_salesinput_day5.[MailOrder Merch Sales], qry_salesinput_day5.[MailOrder Postage Sales], qry_salesinput_day5.[MailOrder Total Sales], qry_salesinput_day5.[Wholesale Praline Sales], qry_salesinput_day5.[Wholesale Merch Sales], qry_salesinput_day5.[Wholesale Postage Sales], qry_salesinput_day5.[Wholesale Total Sales], qry_salesinput_day5.[Planned Store hours], qry_salesinput_day5.[Actual Store hours], qry_salesinput_day5.[Planned Store Dollars], qry_salesinput_day5.[Actual Store Dollars], qry_salesinput_day5.[Overtime Dollars], qry_salesinput_day5.[Training Dollars], qry_salesinput_day5.[Am # of Tickets], qry_salesinput_day5.[Pm # of Tickets], qry_salesinput_day5.[Peak Ticket Hour], qry_salesinput_day6.Day, qry_salesinput_day6.[Store Am sales], qry_salesinput_day6.[Store Pm sales], qry_salesinput_day6.[Store Praline Sales], qry_salesinput_day6.[Store Merch Sales], qry_salesinput_day6.[Store Postage Sales], qry_salesinput_day6.[MailOrder Praline Sales], qry_salesinput_day6.[MailOrder Merch Sales], qry_salesinput_day6.[MailOrder Postage Sales], qry_salesinput_day6.[MailOrder Total Sales], qry_salesinput_day6.[Wholesale Praline Sales], qry_salesinput_day6.[Wholesale Merch Sales], qry_salesinput_day6.[Wholesale Postage Sales], qry_salesinput_day6.[Wholesale Postage Sales], qry_salesinput_day6.[Planned Store hours], qry_salesinput_day6.[Actual Store hours], qry_salesinput_day6.[Planned Store Dollars], qry_salesinput_day6.[Actual Store Dollars], qry_salesinput_day6.[Overtime Dollars], qry_salesinput_day6.[Training Dollars], qry_salesinput_day6.[Am # of Tickets], qry_salesinput_day6.[Pm # of Tickets], qry_salesinput_day6.[Peak Ticket Hour], qry_salesinput_day7.Day, qry_salesinput_day7.[Store Am sales], qry_salesinput_day7.[Store Pm sales], qry_salesinput_day7.[Store Praline Sales], qry_salesinput_day7.[Store Merch Sales], qry_salesinput_day7.[Store Postage Sales], qry_salesinput_day7.[MailOrder Praline Sales], qry_salesinput_day7.[MailOrder Merch Sales], qry_salesinput_day7.[MailOrder Postage Sales], qry_salesinput_day7.[MailOrder Total Sales], qry_salesinput_day7.[Wholesale Praline Sales], qry_salesinput_day7.[Wholesale Merch Sales], qry_salesinput_day7.[Wholesale Postage Sales], qry_salesinput_day7.[Wholesale Total Sales], qry_salesinput_day7.[Planned Store hours], qry_salesinput_day7.[Actual Store hours], qry_salesinput_day7.[Planned Store Dollars], qry_salesinput_day7.[Actual Store Dollars], qry_salesinput_day7.[Overtime Dollars], qry_salesinput_day7.[Training Dollars], qry_salesinput_day7.[Am # of Tickets], qry_salesinput_day7.[Pm # of Tickets], qry_salesinput_day7.[Peak Ticket Hour]
FROM (((((qry_salesinput_day1 INNER JOIN qry_salesinput_day2 ON (qry_salesinput_day1.Period = qry_salesinput_day2.Period) AND (qry_salesinput_day1.Week = qry_salesinput_day2.Week)) LEFT JOIN qry_salesinput_day3 ON (qry_salesinput_day2.Week = qry_salesinput_day3.Week) AND (qry_salesinput_day2.Period = qry_salesinput_day3.Period)) LEFT JOIN qry_salesinput_day4 ON (qry_salesinput_day3.Week = qry_salesinput_day4.Week) AND (qry_salesinput_day3.Period = qry_salesinput_day4.Period)) LEFT JOIN qry_salesinput_day5 ON (qry_salesinput_day4.Week = qry_salesinput_day5.Week) AND (qry_salesinput_day4.Period = qry_salesinput_day5.Period)) LEFT JOIN qry_salesinput_day6 ON (qry_salesinput_day5.Week = qry_salesinput_day6.Week) AND (qry_salesinput_day5.Period = qry_salesinput_day6.Period)) LEFT JOIN qry_salesinput_day7 ON (qry_salesinput_day6.Week = qry_salesinput_day7.Week) AND (qry_salesinput_day6.Period = qry_salesinput_day7.Period);
[/green]
the sql for last year sales inputday.1
Code:
[navy]
PARAMETERS [Enter Beginning Date] DateTime;
SELECT [tbl_des1_daily sales].Period, [tbl_des1_daily sales].Week, Weekday([tbl_des1_daily sales]!Day) AS Expr1, [tbl_des1_daily sales].Day, [tbl_des1_daily sales].[Store Am sales], [tbl_des1_daily sales].[Store Pm sales], [MailOrder Praline Sales]+[MailOrder Merch Sales]+[MailOrder Postage Sales] AS [MailOrder Total Sales], [Wholesale Praline Sales]+[Wholesale Merch Sales]+[Wholesale Postage Sales] AS [WholeSale Total sales], [tbl_des1_daily sales].[Am # of Tickets], [tbl_des1_daily sales].[Pm # of Tickets]
FROM [tbl_des1_daily sales], FindPeriod
WHERE ((([tbl_des1_daily sales].Period)=Val([FindPeriod].[yr_id])) AND (([tbl_des1_daily sales].Week)=Val([findperiod].[period])) AND ((Weekday([tbl_des1_daily sales]![Day]))=1))
ORDER BY [tbl_des1_daily sales].Period, [tbl_des1_daily sales].Week, [tbl_des1_daily sales].Day;
[/navy]
sql for LYsalesinput_master
Code:
[purple]
PARAMETERS [Enter Beginning Date] DateTime;
SELECT qry_LYsalesinput_day1.Period, qry_LYsalesinput_day1.Week, qry_LYsalesinput_day1.Day, qry_LYsalesinput_day1.[Store Am sales], qry_LYsalesinput_day1.[Store Pm sales], qry_LYsalesinput_day1.[MailOrder Total Sales], qry_LYsalesinput_day1.[WholeSale Total sales], qry_LYsalesinput_day1.[Am # of Tickets], qry_LYsalesinput_day1.[Pm # of Tickets], qry_LYsalesinput_day2.Day, qry_LYsalesinput_day2.[Store Am sales], qry_LYsalesinput_day2.[Store Pm sales], qry_LYsalesinput_day2.[MailOrder Total Sales], qry_LYsalesinput_day2.[Wholesale Total Sales], qry_LYsalesinput_day2.[Am # of Tickets], qry_LYsalesinput_day2.[Pm # of Tickets], qry_LYsalesinput_day3.Day, qry_LYsalesinput_day3.[Store Am sales], qry_LYsalesinput_day3.[Store Pm sales], qry_LYsalesinput_day3.[MailOrder Total Sales], qry_LYsalesinput_day3.[Wholesale Total Sales], qry_LYsalesinput_day3.[Am # of Tickets], qry_LYsalesinput_day3.[Pm # of Tickets], qry_LYsalesinput_day4.Day, qry_LYsalesinput_day4.[Store Am sales], qry_LYsalesinput_day4.[Store Pm sales], qry_LYsalesinput_day4.[MailOrder Total Sales], qry_LYsalesinput_day4.[Wholesale Total Sales], qry_LYsalesinput_day4.[Am # of Tickets], qry_LYsalesinput_day4.[Pm # of Tickets], qry_LYsalesinput_day5.Day, qry_LYsalesinput_day5.[Store Am sales], qry_LYsalesinput_day5.[Store Pm sales], qry_LYsalesinput_day5.[MailOrder Total Sales], qry_LYsalesinput_day5.[Wholesale Total Sales], qry_LYsalesinput_day5.[Am # of Tickets], qry_LYsalesinput_day5.[Pm # of Tickets], qry_LYsalesinput_day6.Day, qry_LYsalesinput_day6.[Store Am sales], qry_LYsalesinput_day6.[Store Pm sales], qry_LYsalesinput_day6.[MailOrder Total Sales], qry_LYsalesinput_day6.[Wholesale Total Sales], qry_LYsalesinput_day6.[Am # of Tickets], qry_LYsalesinput_day6.[Pm # of Tickets], qry_LYsalesinput_day7.Day, qry_LYsalesinput_day7.[Store Am sales], qry_LYsalesinput_day7.[Store Pm sales], qry_LYsalesinput_day7.[MailOrder Total Sales], qry_LYsalesinput_day7.[Wholesale Total Sales], qry_LYsalesinput_day7.[Am # of Tickets], qry_LYsalesinput_day7.[Pm # of Tickets]
FROM (qry_LYsalesinput_day1 INNER JOIN (qry_LYsalesinput_day2 LEFT JOIN qry_LYsalesinput_day3 ON (qry_LYsalesinput_day2.Period = qry_LYsalesinput_day3.Period) AND (qry_LYsalesinput_day2.Week = qry_LYsalesinput_day3.Week)) ON (qry_LYsalesinput_day1.Period = qry_LYsalesinput_day2.Period) AND (qry_LYsalesinput_day1.Week = qry_LYsalesinput_day2.Week)) LEFT JOIN (((qry_LYsalesinput_day4 LEFT JOIN qry_LYsalesinput_day5 ON (qry_LYsalesinput_day4.Period = qry_LYsalesinput_day5.Period) AND (qry_LYsalesinput_day4.Week = qry_LYsalesinput_day5.Week)) LEFT JOIN qry_LYsalesinput_day6 ON (qry_LYsalesinput_day5.Period = qry_LYsalesinput_day6.Period) AND (qry_LYsalesinput_day5.Week = qry_LYsalesinput_day6.Week)) LEFT JOIN qry_LYsalesinput_day7 ON (qry_LYsalesinput_day6.Period = qry_LYsalesinput_day7.Period) AND (qry_LYsalesinput_day6.Week = qry_LYsalesinput_day7.Week)) ON (qry_LYsalesinput_day3.Period = qry_LYsalesinput_day4.Period) AND (qry_LYsalesinput_day3.Week = qry_LYsalesinput_day4.Week);
[/purple]

thnx
Marco
[ponder]
 
these expressions are used in the salesinput_day* queries

1. Expr1: Weekday([tbl_des1_daily sales]!Day)
2. Weekday([tbl_des1_daily sales]![Day])

these are the criteria that I have placed in the period & week fields
period: Val([FindPeriod].[yr_id])
week: Val([findperiod].[period])


thanks,
Marco

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top