SQL from first Query. This runs ok.
SELECT [Forecast Data].Site, [Forecast Data].[Year_Week No], [Forecast
Data].Product, [Forecast Data].Kilos, [Grampian Sites].[Site Code]
FROM [Grampian Sites] INNER JOIN [Forecast Data] ON [Grampian Sites].Site
=
[Forecast Data].Site
WHERE ((([Forecast Data].[Year_Week No]) Between [Start Date:2005_01] And
[End Date:2005_52]) AND (([Grampian Sites].[Site Code])=[Enter Site]));
When I put Between [Start Date:2005_01] And [End Date:2005_52]) into Query
Parameters I get asked 3 times for the parameters.
Cross tab query SQL
TRANSFORM Sum([Coupar Arisings].Kilos) AS SumOfKilos
SELECT [Coupar Arisings].Product, Sum([Coupar Arisings].Kilos) AS [Total
Of
Kilos]
FROM [Coupar Arisings]
GROUP BY [Coupar Arisings].Product
PIVOT [Coupar Arisings].[Year_Week No];
John Spencer said:
Well, without seeing the SQL for any of the queries, all I can propose is
that JET thinks you have [Start Date:2005-01] in the SQL. It can't find
a
field or defined parameter with that name. That is why the error
message.
Please copy and post the SQL of your query (queries).
(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message
The query doesn't run and I get the following error message - The
Microsoft
Jet database engine does not recognize '[Start Date:2005_01]' as a
valid
field name or expression.
2005_01 is a customised date field e.g. Week 01 of 2005!! which would
make
it a text field. In the original query (which the cross tab runs over)
when I
have Between [Start Date] And [End Date] in the criteria, the records
return
as I would expect.
When I try and run the cross tab I get the error message.
:
"Falls over" is not very descriptive of whatever problem you are
having.
That could mean
-- The query doesn't run and you get an error message
-- The query returns bad results (too many, too few, wrong ones, no
records)
-- The query runs forever/locks up your computer
You have typed [Enter Start Date] as Text instead of as DateTime. Is
that
correct?
That implies that Year_Week No is a text field. Is that the case?
I have been able to get cross tab query working with criteria
options. I
can
use ENTER to return a specific week on my cross tab query and it
works
fine!
When I try to use Between to get a start date and an end date my
cross
tab
falls over!!
Any ideas?
Thanks
PARAMETERS [Enter Site] Text ( 255 ), [Enter Start Date] Text (
255 );
SELECT [Forecast Data].Site, [Forecast Data].[Year_Week No],
[Forecast
Data].Product, [Forecast Data].Kilos, [Grampian Sites].[Site Code]
FROM [Grampian Sites] INNER JOIN [Forecast Data] ON [Grampian
Sites].Site
=
[Forecast Data].Site
WHERE ((([Forecast Data].[Year_Week No])=[Enter Start Date]) AND
(([Grampian
Sites].[Site Code])=[Enter Site]));