Calendar Report

  • Thread starter Jennifer Wells via AccessMonster.com
  • Start date
J

Jennifer Wells via AccessMonster.com

I have a report that prints as a calendar. The details section of my
report is split into 7 columns, and in the On Format section of my detail,
i have the following code which sets the date under the correct column (Sun-
Sat) according to the day:

icounter = icounter + 1
If Weekday(Me.Date, vbSunday) > icounter Then
Me.MoveLayout = True
Me.NextRecord = False
Me.PrintSection = False
End If

it works great to put the date in the correct column for the first page of
my report. however, i want to group date by month and have a page break
after each month. i can do so with the Force New Page property of my
DateHeader, however, the dates on the subsequent pages are not set to the
correct columns (Sun-Sat.). How can i do a page break after each month,
and reset the dates to the correct day columns???? Any advice is GREATLY
appreciated!!!!
 
D

Duane Hookom

It isn't clear if you are just drawing a calendar or if you are adding data.
There are sample calendar style reports at
http://www.invisibleinc.com/divFiles.cfm?divDivID=4. The calendar report
could be grouped by both Month of and WeekOf if you want to split the months
into separate pages.

The following code draws a calendar on a report page.


Private Sub Report_Page()
Dim lngDayHeight As Long
Dim lngDayWidth As Long
Dim datRptDate As Date
Dim intStartWeek As Integer
Dim lngTopMargin As Long
Dim dat1stMth As Date
Dim datDay As Date
Dim lngTop As Long
Dim lngLeft As Long
datRptDate = Date
dat1stMth = DateSerial(Year(datRptDate), Month(datRptDate), 1)
intStartWeek = DatePart("ww", dat1stMth)
lngDayHeight = 2160 'one & half inch
lngDayWidth = 1440 'one inch
lngTopMargin = 720 'half inch
Me.FontSize = 22
'loop through all days in month
For datDay = dat1stMth To DateAdd("m", 1, dat1stMth) - 1
'find the top and left corner
lngTop = (DatePart("ww", datDay) - intStartWeek) * _
lngDayHeight + lngTopMargin
lngLeft = (Weekday(datDay) - 1) * lngDayWidth
If Weekday(datDay) = 1 Or Weekday(datDay) = 7 Then
Me.DrawWidth = 8
Else
Me.DrawWidth = 1
End If
'draw a rectangle for day
Me.Line (lngLeft, lngTop)-Step _
(lngDayWidth, lngDayHeight), , B
Me.CurrentX = lngLeft + 50
Me.CurrentY = lngTop + 50
Me.Print Day(datDay)
Next
End Sub
 
J

Jennifer Wells via AccessMonster.com

I am not just drawing a calendar on the report. I have a subreport that
displays data depending on the date.
 
D

Duane Hookom

Did you check the link that I suggested? It has "day" subreports on a main
report.
 

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