Full Version: Query
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
mike1981
I have a table that has data something like this

Name|Costing type|Date

Mike Jervis |Admin Support| 06/12/2004
Gallagher, Maura |Training|04/1/2004
Julia, Booth |Admin Support|09/19/2005
Khan, Mohammed |Vacation|02/1/2005
Mike Jervis |Training|10/11/2004

I am making a report something like this:


Mike Jervis
Admin Support 1
Training 1
Vacation

Gallager Maura
Admin Support
Training 1
Vacation

.
.
.
I am doing this using a crosstab query. When the query executes i want it to ask u the name and then the range of dates. This is what i included in the query design view.

Like "*" & UCase([ENTER PART OF NAME]) & "*"
Between DLookUp("[ReportStartDate]","[tblReportDates]") And DLookUp("[ReportEndDate]","[tblReportDates]")

So it should take the name as an input and i hard code the date ranges in the tblReportData and it should execute. Say for eg: If i put in Jervis, Mike as the name and the dates are encoded(6/12/2004 - 10/11/2004), i want the report to show

Mike Jervis
Admin Support 1
Training 1
Vacation

I am not gettin it right. Please if someone could help.
THanks
Mo
fkegley
Yes, develop a select query that fetches the data you want in your crosstab. Then base the crosstab on that query.
mike1981
Frank I tried this:

I made a select quey that extracts the

Name | Costing Type| Date with the criteria's
Like "*" & UCase([ENTER PART OF NAME]) & "*"
Between DLookUp("[ReportStartDate]","[tblReportDates]") And DLookUp("[ReportEndDate]","[tblReportDates]")

When i run the select query it works. Now when i am making a crosstab query out of this, I am getting an error saying that property does not exist and it gives an error on [ENTER PART OF NAME] sayn that the jet database does not recognize it.

Mo.
vtd
With SELECT Queries, declaration of Parameters are not compulsory but with Cross-Tab Queries, you musrt declare all Parameters used.

Use the Menu Query / Parameters ... and declare [ENTER PART OF NAME] as a Parameter of Text / String type.
mike1981
You saying i sould declare this in the crosstab query right. I did that. It does not give me an error anymore, but the query does not display any data.
mike1981
It worked!!!!
Gr8..thank u thanku!!
mike1981
Just another question. Instead of using
Between DLookUp("[ReportStartDate]","[tblReportDates]") And DLookUp("[ReportEndDate]","[tblReportDates]")

Can i ask for the startdate and the end date when i execute the query instead of it picking it from tblReprtDates?

Thanks alot
<Mo.
vtd
Yep ... but remember to declare the [StartDate] and [EndDate] as Parameters of DateTime DataType also.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.