help me please

G

Guest

i am trying to creat crosstab query , for selected period entered thru a
form.this is the sql for it.
TRANSFORM Sum(PATIENTS.[NO OF PATIENTS]) AS [SumOfNO OF PATIENTS]
SELECT PATIENTS.DIAG
FROM PATIENTS
WHERE (((PATIENTS.travel) Between [Forms]![my date range99]![from] And
[Forms]![my date range99]![to]))
GROUP BY PATIENTS.DIAG
PIVOT PATIENTS.COUNTRY;

but i am not able to get it work as i get the following mesage:

the microsoft jet database engine does not recognise "[forms]![my date
range99]![from] as a valid field name or expression"

(the form is to enter the "Travel" dates( from , to.)and one button to open
the query., the Travel column in the qry is set to Where and the criteria is

Between [Forms]![my date range99]![from] And [Forms]![my date range99]![to]


please help with this problem
thank you
 
J

John Spencer

First thing, with a crosstab query you MUST declare your parameters and if
any
other queries are used in the crosstab their parameters must also be
declared.

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2

In the SQL text window that would look like

Parameters [Forms]![my date range99]![from] DateTime, [Forms]![my date
range99]![to] DateTime;
TRANSFORM Sum(PATIENTS.[NO OF PATIENTS]) AS [SumOfNO OF PATIENTS]
SELECT ...
 
G

Guest

John Spencer said:
First thing, with a crosstab query you MUST declare your parameters and if
any
other queries are used in the crosstab their parameters must also be
declared.

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2

In the SQL text window that would look like

Parameters [Forms]![my date range99]![from] DateTime, [Forms]![my date
range99]![to] DateTime;
TRANSFORM Sum(PATIENTS.[NO OF PATIENTS]) AS [SumOfNO OF PATIENTS]
SELECT ...


that works fine ..
thank you for response and help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top