A
Audrey1980
Hi,
I have a query to get the average margin per store for a particular week and
year.
If I hard code the week, year and store in the where clause this query
works, however if I actually use the form values it doesnt!
If I use the subquery only with the form values all is well.
Any ideas? I've tried breaking this into 2 seperate queries but getting the
same issue on the summary query...please help!!
Audrey
PARAMETERS [Forms]![Main Menu]![Store] Text ( 255 ), [Forms]![Main
Menu]![Year] Text ( 255 ), [Forms]![Main Menu]![Week] Text ( 255 );
SELECT dbo_Despatch_data_branch_summary.Branch AS Store,
Round(Avg([%$##@_Alias].[Input Margin]),2) AS [Avg Of Input Margin]
FROM [SELECT dbo_Despatch_data_branch_summary.Branch,
(([Extd_REV]-[Extd_WCEV])/[Extd_REV]) AS [Input Margin],
dbo_Despatch_data_branch_summary.Extd_WCEV,
dbo_Despatch_data_branch_summary.Extd_REV
FROM dbo_Despatch_data_branch_summary
WHERE (((dbo_Despatch_data_branch_summary.Year)= [Forms]![Main Menu]![Year])
AND ((dbo_Despatch_data_branch_summary.Week)= [Forms]![Main Menu]![Week]) AND
((dbo_Despatch_data_branch_summary.Branch)= [Forms]![Main Menu]![Store]))
GROUP BY dbo_Despatch_data_branch_summary.Branch,
dbo_Despatch_data_branch_summary.Extd_WCEV,
dbo_Despatch_data_branch_summary.Extd_REV
]. AS [%$##@_Alias]
GROUP BY dbo_Despatch_data_branch_summary.Branch;
I have a query to get the average margin per store for a particular week and
year.
If I hard code the week, year and store in the where clause this query
works, however if I actually use the form values it doesnt!
If I use the subquery only with the form values all is well.
Any ideas? I've tried breaking this into 2 seperate queries but getting the
same issue on the summary query...please help!!
Audrey
PARAMETERS [Forms]![Main Menu]![Store] Text ( 255 ), [Forms]![Main
Menu]![Year] Text ( 255 ), [Forms]![Main Menu]![Week] Text ( 255 );
SELECT dbo_Despatch_data_branch_summary.Branch AS Store,
Round(Avg([%$##@_Alias].[Input Margin]),2) AS [Avg Of Input Margin]
FROM [SELECT dbo_Despatch_data_branch_summary.Branch,
(([Extd_REV]-[Extd_WCEV])/[Extd_REV]) AS [Input Margin],
dbo_Despatch_data_branch_summary.Extd_WCEV,
dbo_Despatch_data_branch_summary.Extd_REV
FROM dbo_Despatch_data_branch_summary
WHERE (((dbo_Despatch_data_branch_summary.Year)= [Forms]![Main Menu]![Year])
AND ((dbo_Despatch_data_branch_summary.Week)= [Forms]![Main Menu]![Week]) AND
((dbo_Despatch_data_branch_summary.Branch)= [Forms]![Main Menu]![Store]))
GROUP BY dbo_Despatch_data_branch_summary.Branch,
dbo_Despatch_data_branch_summary.Extd_WCEV,
dbo_Despatch_data_branch_summary.Extd_REV
]. AS [%$##@_Alias]
GROUP BY dbo_Despatch_data_branch_summary.Branch;