Date Range Issue

K

Kevin

I have a database where I am attempting to create a complex weekly
report for employee production. I am struggling with the date portion
of this project.

The table I have includes the following production information.
Date - Associate Number - PIN - Company - Job Code - Units
- Hours - Wage - Goal

The next step is to have a user select a data range from a form I have
created and click a command button that does two things.

First the command button runs a make table query based on my production
table information listed above and the date range that was included on
the form. The second thing the command button does is to run a cross
tab query on my make table query to create a query that looks like
this.

PIN - Number - Goal - Date - Total Units - Total Hours -
Average - Accuracy

This is working perfectly.

The problem I am having involves my dates. The cross tab query I have
runs great however when I create a report based on it, whatever dates
it returns (which were selected by the user on the form) are included
for selection in the report. For instance if the user selects the date
range from 12/12/06 - 12/16/06 all these days are included as fields
I can use to build my report. The label and the text both include the
date in the range that was selected. When another report is run where
different dates are used it bombs out since it's looking for the
previous date range the form was created with.

What I need to do is somewhere along the line before I get to the
report is move my dates into another table where the first date in the
range selected becomes date1, the second becomes date2 and so on. How
can this be done? Can I make another query to tell Access look at a
specific cell within a record and place that value in a specific cell?
 
M

Marshall Barton

Kevin said:
I have a database where I am attempting to create a complex weekly
report for employee production. I am struggling with the date portion
of this project.

The table I have includes the following production information.
Date - Associate Number - PIN - Company - Job Code - Units
- Hours - Wage - Goal

The next step is to have a user select a data range from a form I have
created and click a command button that does two things.

First the command button runs a make table query based on my production
table information listed above and the date range that was included on
the form. The second thing the command button does is to run a cross
tab query on my make table query to create a query that looks like
this.

PIN - Number - Goal - Date - Total Units - Total Hours -
Average - Accuracy

This is working perfectly.

The problem I am having involves my dates. The cross tab query I have
runs great however when I create a report based on it, whatever dates
it returns (which were selected by the user on the form) are included
for selection in the report. For instance if the user selects the date
range from 12/12/06 - 12/16/06 all these days are included as fields
I can use to build my report. The label and the text both include the
date in the range that was selected. When another report is run where
different dates are used it bombs out since it's looking for the
previous date range the form was created with.

What I need to do is somewhere along the line before I get to the
report is move my dates into another table where the first date in the
range selected becomes date1, the second becomes date2 and so on. How
can this be done? Can I make another query to tell Access look at a
specific cell within a record and place that value in a specific cell?


Try using a relative date
DateDiff("d", startdate, [Datefield])
as the column headings in the crosstab query.

Normally, dumping data into new tables is not a good idea.
 

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