S
Simeon Cheeseman
Hi there.
I got a sample database with several reports from the forums
(http://www.access.hookom.net/Samples.htm.) and I am trying to convert one to
work with days months instead of days and hours. I am using the 'weekly
schedule by doctor'. My converted code is as follows:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim lngTopMargin As Long
Dim lngOneMinute As Long 'size of one minute in twips
Dim datSchedStart As Date
Dim strdate As String
Dim startdate As Date
Dim enddate As Date
Dim ttest As String
startdate = Me.Month & "/" & Me.Start & "/" & Me.Year
enddate = Me.Month & "/" & Me.End & "/" & Me.Year
strdate = "1/1/" & Me.Year & ""
datSchedStart = strdate
lngOneMinute = 12 'number of twips in one minute
lngTopMargin = 720 'timeline starts 1/2" down in section
ttest = datediff("d", datSchedStart, startdate)
Me.MoveLayout = False
Me.child_id.Top = lngTopMargin + ttest * lngOneMinute
Me.child_id.Height = datediff("d", startdate, enddate) * lngOneMinute
Me.child_id.Left = 2160
'DateDiff("m", Me.Month, Me.Month) *
End Sub
And this is my replacement SQL query:
SELECT DatePart("m",[date_booked_start]) AS [Month],
DatePart("d",[date_booked_start]) AS Start, tbl_bookings.house,
DatePart("d",[date_booked_end]) AS [End],
DateAdd("m",-Month([Month]),[Month])+1 AS WeekOf, tbl_bookings.child_id,
tbl_house.reportcolumn, DatePart("yyyy",[date_booked_start]) AS [Year]
FROM tbl_house INNER JOIN (tbl_details INNER JOIN tbl_bookings ON
tbl_details.child_id = tbl_bookings.child_id) ON tbl_house.house_name =
tbl_bookings.house;
Thanks Simeon.
I got a sample database with several reports from the forums
(http://www.access.hookom.net/Samples.htm.) and I am trying to convert one to
work with days months instead of days and hours. I am using the 'weekly
schedule by doctor'. My converted code is as follows:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim lngTopMargin As Long
Dim lngOneMinute As Long 'size of one minute in twips
Dim datSchedStart As Date
Dim strdate As String
Dim startdate As Date
Dim enddate As Date
Dim ttest As String
startdate = Me.Month & "/" & Me.Start & "/" & Me.Year
enddate = Me.Month & "/" & Me.End & "/" & Me.Year
strdate = "1/1/" & Me.Year & ""
datSchedStart = strdate
lngOneMinute = 12 'number of twips in one minute
lngTopMargin = 720 'timeline starts 1/2" down in section
ttest = datediff("d", datSchedStart, startdate)
Me.MoveLayout = False
Me.child_id.Top = lngTopMargin + ttest * lngOneMinute
Me.child_id.Height = datediff("d", startdate, enddate) * lngOneMinute
Me.child_id.Left = 2160
'DateDiff("m", Me.Month, Me.Month) *
End Sub
And this is my replacement SQL query:
SELECT DatePart("m",[date_booked_start]) AS [Month],
DatePart("d",[date_booked_start]) AS Start, tbl_bookings.house,
DatePart("d",[date_booked_end]) AS [End],
DateAdd("m",-Month([Month]),[Month])+1 AS WeekOf, tbl_bookings.child_id,
tbl_house.reportcolumn, DatePart("yyyy",[date_booked_start]) AS [Year]
FROM tbl_house INNER JOIN (tbl_details INNER JOIN tbl_bookings ON
tbl_details.child_id = tbl_bookings.child_id) ON tbl_house.house_name =
tbl_bookings.house;
Thanks Simeon.