There are 3 common ways of getting parameters into a query.
1) Place what looks like a field name, but isn't, in the criteria of the
query. When the name isn't recognized, you'll be prompted for it when the
query is run.
Example:
SELECT tblMyTable.* FROM tblMyTable WHERE tblMyTable.MyField = [Enter a
Value];
2) Have a form with the values you want to use. Refer to the controls on the
form in the criteria.
Example:
SELECT tblMyTable.* FROM tblMyTable WHERE tblMyTable.MyField =
Forms!frmMyFrom!txtMyTextbox;
3) Create the SQL for the query in code and then "rewrite" the query.
Example:
strSQL = "SELECT tblMyTable.* FROM tblMyTable WHERE tblMyTable.MyField =
#1/1/2004#;"
CurrentDb.QueryDefs("qryMyQuery").SQL = strSQL
I hope this helps. I haven't done much work with cross-tab queries, but the
basics for getting the information into them is the same.
--
Wayne Morgan
MS Access MVP
Tom said:
I have created one table that contains dates and opening and closing
figures
for each day. I have created a query and extracted from the date: Month,
Week
No, and Weekday Name. I then created a crosstab query to show in the Row
Heading: Month, Week (shown as the date of the first day of that week),
and
Sum Total of the figures. The Column Heading is the Weekdays. The Crosstab
query works fine.
However, the problem is when I create a report. The report looks great but
the parameters only give me the year I hard coded. I would like to be able
to
enter a typical Start and End date and it disply the information in the
crosstab report by the week.
I tried to send you the crosstab but it will not let me paste it into this
screen. I hope I have given you enough information to help.
Thanks for all your time and effort.
Tom