dbTalk Databases Forums  

reports and dates

comp.databases.ms-access comp.databases.ms-access


Discuss reports and dates in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kevcar40
 
Posts: n/a

Default reports and dates - 04-12-2011 , 08:27 AM






hi
I have created a Crosstab query
the headers are the days of the month ie January 1-31
April 1-30
no problem with the query
however how do i show this data on a form/ report that
will automatically show the days for the month
so if the user selected January i would like the fileds to show 1 to 31
if the user selected April i would like the fileds to show 1 to 30
can this be done without having to create a report for each month


thanks


kevin

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 08:38 AM






kevcar40 wrote:
Quote:
hi
I have created a Crosstab query
the headers are the days of the month ie January 1-31
April 1-30
no problem with the query
however how do i show this data on a form/ report that
will automatically show the days for the month
so if the user selected January i would like the fileds to show 1 to
31 if the user selected April i would like the fileds to show 1 to 30
can this be done without having to create a report for each month


I don't understand. You said " ... the headers are the days of the month ...
" and then ask how to get a report to show those headers? I think we need
more details.

Reply With Quote
  #3  
Old   
kevcar40
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 08:55 AM



when i create the report say for April
the days are 1, 2, 3 , 4 .......30
and the report shows fields / labels 1 - 30
if i create for March
the days are 1, 2, 3 , 4 .......31
but the report only shows fields / labels 1 - 30
i would like the fields/labels to change to reflect the number of days in the month

Reply With Quote
  #4  
Old   
Bob Barrows
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 09:07 AM



kevcar40 wrote:
Quote:
when i create the report say for April
the days are 1, 2, 3 , 4 .......30
and the report shows fields / labels 1 - 30
if i create for March
the days are 1, 2, 3 , 4 .......31
but the report only shows fields / labels 1 - 30
i would like the fields/labels to change to reflect the number of
days in the month
Ah, now I understand. That is a problem that has existed since A97. I was
hoping they would have fixed that by A2010.
Err ... what version of Access are you using?

Anyways, here are some search results that can get you started:

Reply With Quote
  #5  
Old   
kevcar40
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 09:09 AM



at the moment 2003
but hopefully soon 2010
reading your reply looks like i going to have to create several reports with default days (yuk)

Reply With Quote
  #6  
Old   
Bob Barrows
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 09:13 AM



Bob Barrows wrote:
Quote:
kevcar40 wrote:
when i create the report say for April
the days are 1, 2, 3 , 4 .......30
and the report shows fields / labels 1 - 30
if i create for March
the days are 1, 2, 3 , 4 .......31
but the report only shows fields / labels 1 - 30
i would like the fields/labels to change to reflect the number of
days in the month

Ah, now I understand. That is a problem that has existed since A97. I
was hoping they would have fixed that by A2010.
Err ... what version of Access are you using?

Anyways, here are some search results that can get you started:
Hmm, how did that happen? I pressed ctrl-c and the message sent itself ...
Anyways:
http://www.google.com/search?q=MS%20...=hp&channel=np

This one seems particularly pertinent:

Reply With Quote
  #7  
Old   
Bob Barrows
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 09:14 AM



Bob Barrows wrote:
Quote:
Bob Barrows wrote:
kevcar40 wrote:
when i create the report say for April
the days are 1, 2, 3 , 4 .......30
and the report shows fields / labels 1 - 30
if i create for March
the days are 1, 2, 3 , 4 .......31
but the report only shows fields / labels 1 - 30
i would like the fields/labels to change to reflect the number of
days in the month

Ah, now I understand. That is a problem that has existed since A97. I
was hoping they would have fixed that by A2010.
Err ... what version of Access are you using?

Anyways, here are some search results that can get you started:

Hmm, how did that happen? I pressed ctrl-c and the message sent
itself ... Anyways:

http://www.google.com/search?q=MS%20...=hp&channel=np

This one seems particularly pertinent:
http://support.microsoft.com/kb/328320

Reply With Quote
  #8  
Old   
Marshall Barton
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 12:32 PM



kevcar40 wrote:
Quote:
I have created a Crosstab query
the headers are the days of the month ie January 1-31
April 1-30
no problem with the query
however how do i show this data on a form/ report that
will automatically show the days for the month
so if the user selected January i would like the fileds to show 1 to 31
if the user selected April i would like the fileds to show 1 to 30
can this be done without having to create a report for each month

You could use code in the header's format event that checks
the month and makes the inappropriate days invisible:

Select Case monthfield
Case 2
Me.lbl30.Visible = False
Me.txt30.Visible = False
Me.txt30.ControlSource = ""
Me.lbl31.Visible = False
Me.txt31.Visible = False
Me.txt31.ControlSource = ""
If yearfield Mod 4 Then
Me.lbl29.Visible = False
Me.txt29.Visible = False
Me.txt29.ControlSource = ""
End If
Case 4,6,9,11
Me.lbl31.Visible = False
Me.txt31.Visible = False
Me.txt31.ControlSource = ""
End Select

--
Marsh

Reply With Quote
  #9  
Old   
Bob Quintal
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 04:58 PM



kevcar40 <kevcar40 (AT) btinternet (DOT) com> wrote in
news:f375b9ec-421f-433c-b7b3-65ded6273f9f (AT) glegroupsg2000goo (DOT) googlegro
ups.com:

Quote:
hi
I have created a Crosstab query
the headers are the days of the month ie January 1-31
April 1-30
no problem with the query
however how do i show this data on a form/ report that
will automatically show the days for the month
so if the user selected January i would like the fileds to show 1
to 31 if the user selected April i would like the fileds to show
1 to 30 can this be done without having to create a report for
each month


thanks


kevin



First, in the crosstab query, bring up the properties box.
In the Query properties row titled column headings, insert the string
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ,21,22,23,24,25,26,
27,28,29,30,31

Now the query will produce a column for each of those numbers, even
if there is no data for that day. This is also useful for making a
column if the 12 of April as example has no data.

Design the form or report to show all those columns. You can then
write some code to make the column and the header invisible if the
day is greater than the number of days in the selected month.

A handy way of getting the number of days in a month is
DaysInMonth = day(DateSerial(year(mydate),month(mydate)+1,0))
which correctly handles year-ends



--
Bob Q.
PA is y I've altered my address.

Reply With Quote
  #10  
Old   
Salad
 
Posts: n/a

Default Re: reports and dates - 04-12-2011 , 09:55 PM



kevcar40 wrote:
Quote:
hi
I have created a Crosstab query
the headers are the days of the month ie January 1-31
April 1-30
no problem with the query
however how do i show this data on a form/ report that
will automatically show the days for the month
so if the user selected January i would like the fileds to show 1 to 31
if the user selected April i would like the fileds to show 1 to 30
can this be done without having to create a report for each month


thanks


kevin



This link might help. You'd need to adjust but the concept is the same.
http://www.fmsinc.com/tpapers/access...hly/index.html

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.