A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Crosstab Report and query



 
 
Thread Tools Display Modes
  #1  
Old May 24th, 2004, 07:19 PM
Newbie
external usenet poster
 
Posts: n/a
Default Crosstab Report and query

Hi,

I have the following query - see below

I want a report that is based on week number - the actual week number needs
to be on the report.

I have written a query that inserts all the relevant records into a table
incl. the week number where it substitues anything that is older than 12
weeks before the entered date as a week 0
eg. date = 19/5/04 = week 21
date = 23/2/04 = week 0

I want my report to display 12 weeks prior to the date entered on a form
plus the Week 0

At the moment if a particular week doesn;t have any data it is missed out
completely.

How can I ensure that all 12 weeks will be reported?

Here is the crosstab query that I have

PARAMETERS [forms]![frmMetalRequirements]![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, Sum(tblMatlSchedule.OSQtyReqd) AS [Total Of
OSQtyReqd]
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate
PIVOT tblMatlSchedule.WeekNo;



  #2  
Old May 24th, 2004, 07:52 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default Crosstab Report and query

This is where I would use "relative weeks" rather than "absolute weeks".
Relative weeks would compare your date field to a date entered on a form to
create the columns. For instance, you could use an expression like:
ColHead:"Wk" & Datediff("ww",[DivDate],[Forms]![frmA]![txtEndDate])
This would create column headings like
"Wk0", "Wk1", "Wk2", "Wk3",...
Wk0 would contain the values for DivDate in the same week as txtEndDate. Wk6
would be 6 weeks earlier. You would need to set the Query|Parameters
[Forms]![frmA]![txtEndDate] Date/Time
and set the Column Headings property to
"Wk0", "Wk1", "Wk2", "Wk3",... (depends on how many weeks)
This method allows you to create a report that will ALWAYS have the same
column/fields. It requires no code and no future maintenance of the query or
report.


--
Duane Hookom
MS Access MVP
--

"Newbie" wrote in message
...
Hi,

I have the following query - see below

I want a report that is based on week number - the actual week number

needs
to be on the report.

I have written a query that inserts all the relevant records into a table
incl. the week number where it substitues anything that is older than 12
weeks before the entered date as a week 0
eg. date = 19/5/04 = week 21
date = 23/2/04 = week 0

I want my report to display 12 weeks prior to the date entered on a form
plus the Week 0

At the moment if a particular week doesn;t have any data it is missed out
completely.

How can I ensure that all 12 weeks will be reported?

Here is the crosstab query that I have

PARAMETERS [forms]![frmMetalRequirements]![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, Sum(tblMatlSchedule.OSQtyReqd) AS [Total Of
OSQtyReqd]
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate
PIVOT tblMatlSchedule.WeekNo;





  #3  
Old May 25th, 2004, 07:57 AM
Newbie
external usenet poster
 
Posts: n/a
Default Crosstab Report and query

Thanks but . . . .
how will this cope with my requirement to report all weeks that are earlier
than the 11 weeks I want to report all being added into 1 column labelled
overdue?

Based on my query what do I need to do?

PARAMETERS [forms]![frmMetalRequirements]![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, Sum(tblMatlSchedule.OSQtyReqd) AS [Total Of
OSQtyReqd]
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate
PIVOT tblMatlSchedule.WeekNo;

Thanks again for your help

"Duane Hookom" wrote in message
...
This is where I would use "relative weeks" rather than "absolute weeks".
Relative weeks would compare your date field to a date entered on a form

to
create the columns. For instance, you could use an expression like:
ColHead:"Wk" & Datediff("ww",[DivDate],[Forms]![frmA]![txtEndDate])
This would create column headings like
"Wk0", "Wk1", "Wk2", "Wk3",...
Wk0 would contain the values for DivDate in the same week as txtEndDate.

Wk6
would be 6 weeks earlier. You would need to set the Query|Parameters
[Forms]![frmA]![txtEndDate] Date/Time
and set the Column Headings property to
"Wk0", "Wk1", "Wk2", "Wk3",... (depends on how many weeks)
This method allows you to create a report that will ALWAYS have the same
column/fields. It requires no code and no future maintenance of the query

or
report.


--
Duane Hookom
MS Access MVP
--

"Newbie" wrote in message
...
Hi,

I have the following query - see below

I want a report that is based on week number - the actual week number

needs
to be on the report.

I have written a query that inserts all the relevant records into a

table
incl. the week number where it substitues anything that is older than 12
weeks before the entered date as a week 0
eg. date = 19/5/04 = week 21
date = 23/2/04 = week 0

I want my report to display 12 weeks prior to the date entered on a form
plus the Week 0

At the moment if a particular week doesn;t have any data it is missed

out
completely.

How can I ensure that all 12 weeks will be reported?

Here is the crosstab query that I have

PARAMETERS [forms]![frmMetalRequirements]![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, Sum(tblMatlSchedule.OSQtyReqd) AS [Total Of
OSQtyReqd]
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate
PIVOT tblMatlSchedule.WeekNo;







  #4  
Old May 25th, 2004, 05:32 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default Crosstab Report and query

Using my suggestion, I would set the column heading expression to something
like:
ColHead:"Wk" & IIf(DateDiff("ww", [YourDate], Forms!frmA!txtEndDate) 11,
"11", Datediff("ww",[YourDate], [Forms]![frmA]![txtEndDate]))


--
Duane Hookom
MS Access MVP
--

"Newbie" wrote in message
...
Thanks but . . . .
how will this cope with my requirement to report all weeks that are

earlier
than the 11 weeks I want to report all being added into 1 column labelled
overdue?

Based on my query what do I need to do?

PARAMETERS [forms]![frmMetalRequirements]![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, Sum(tblMatlSchedule.OSQtyReqd) AS [Total Of
OSQtyReqd]
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate
PIVOT tblMatlSchedule.WeekNo;

Thanks again for your help

"Duane Hookom" wrote in message
...
This is where I would use "relative weeks" rather than "absolute weeks".
Relative weeks would compare your date field to a date entered on a form

to
create the columns. For instance, you could use an expression like:
ColHead:"Wk" & Datediff("ww",[DivDate],[Forms]![frmA]![txtEndDate])
This would create column headings like
"Wk0", "Wk1", "Wk2", "Wk3",...
Wk0 would contain the values for DivDate in the same week as txtEndDate.

Wk6
would be 6 weeks earlier. You would need to set the Query|Parameters
[Forms]![frmA]![txtEndDate] Date/Time
and set the Column Headings property to
"Wk0", "Wk1", "Wk2", "Wk3",... (depends on how many weeks)
This method allows you to create a report that will ALWAYS have the same
column/fields. It requires no code and no future maintenance of the

query
or
report.


--
Duane Hookom
MS Access MVP
--

"Newbie" wrote in message
...
Hi,

I have the following query - see below

I want a report that is based on week number - the actual week number

needs
to be on the report.

I have written a query that inserts all the relevant records into a

table
incl. the week number where it substitues anything that is older than

12
weeks before the entered date as a week 0
eg. date = 19/5/04 = week 21
date = 23/2/04 = week 0

I want my report to display 12 weeks prior to the date entered on a

form
plus the Week 0

At the moment if a particular week doesn;t have any data it is missed

out
completely.

How can I ensure that all 12 weeks will be reported?

Here is the crosstab query that I have

PARAMETERS [forms]![frmMetalRequirements]![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, Sum(tblMatlSchedule.OSQtyReqd) AS [Total Of
OSQtyReqd]
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate
PIVOT tblMatlSchedule.WeekNo;









  #5  
Old May 26th, 2004, 05:11 PM
Newbie
external usenet poster
 
Posts: n/a
Default Crosstab Report and query

Thanks - works a treat!
"Duane Hookom" wrote in message
...
Using my suggestion, I would set the column heading expression to

something
like:
ColHead:"Wk" & IIf(DateDiff("ww", [YourDate], Forms!frmA!txtEndDate) 11,
"11", Datediff("ww",[YourDate], [Forms]![frmA]![txtEndDate]))


--
Duane Hookom
MS Access MVP
--

"Newbie" wrote in message
...
Thanks but . . . .
how will this cope with my requirement to report all weeks that are

earlier
than the 11 weeks I want to report all being added into 1 column

labelled
overdue?

Based on my query what do I need to do?

PARAMETERS [forms]![frmMetalRequirements]![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, Sum(tblMatlSchedule.OSQtyReqd) AS [Total Of
OSQtyReqd]
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate
PIVOT tblMatlSchedule.WeekNo;

Thanks again for your help

"Duane Hookom" wrote in message
...
This is where I would use "relative weeks" rather than "absolute

weeks".
Relative weeks would compare your date field to a date entered on a

form
to
create the columns. For instance, you could use an expression like:
ColHead:"Wk" & Datediff("ww",[DivDate],[Forms]![frmA]![txtEndDate])
This would create column headings like
"Wk0", "Wk1", "Wk2", "Wk3",...
Wk0 would contain the values for DivDate in the same week as

txtEndDate.
Wk6
would be 6 weeks earlier. You would need to set the Query|Parameters
[Forms]![frmA]![txtEndDate] Date/Time
and set the Column Headings property to
"Wk0", "Wk1", "Wk2", "Wk3",... (depends on how many weeks)
This method allows you to create a report that will ALWAYS have the

same
column/fields. It requires no code and no future maintenance of the

query
or
report.


--
Duane Hookom
MS Access MVP
--

"Newbie" wrote in message
...
Hi,

I have the following query - see below

I want a report that is based on week number - the actual week

number
needs
to be on the report.

I have written a query that inserts all the relevant records into a

table
incl. the week number where it substitues anything that is older

than
12
weeks before the entered date as a week 0
eg. date = 19/5/04 = week 21
date = 23/2/04 = week 0

I want my report to display 12 weeks prior to the date entered on a

form
plus the Week 0

At the moment if a particular week doesn;t have any data it is

missed
out
completely.

How can I ensure that all 12 weeks will be reported?

Here is the crosstab query that I have

PARAMETERS [forms]![frmMetalRequirements]![dtpDateTo] DateTime;
TRANSFORM Sum(tblMatlSchedule.OSQtyReqd) AS SumOfOSQtyReqd
SELECT tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate, Sum(tblMatlSchedule.OSQtyReqd) AS [Total

Of
OSQtyReqd]
FROM tblMatlSchedule
GROUP BY tblMatlSchedule.JobNo, tblMatlSchedule.Stockcode,
tblMatlSchedule.StartDate
PIVOT tblMatlSchedule.WeekNo;











 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:23 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.