Hi,
I'm trying to do a report in the format of the image attached to this thread (the lower part of the image). It has employee information on the right side and schedule information on the left side (informations are ClientName, DebutTime, FinalTime). Each employee has many schedules. I wanted to have all schedules on the same line, so I used the Movelayout = False and the left property to place the schedule under it's date.
The user types the first day on a form and then the report opens. The schedule has been built as a subreport which is linked with the EmployeeID.
The problem is that some records don't show up on the preview, it seems the movelayout and the Canshrink, Cangrow are the culprits. Let me explain, with Movelayout = True, I can see each record on differents lines and when I start moving the textboxes, some records are seen partially (see top of image in attachment) and I would like the cangrow and canshrink to be false.
In the image, the first employee should have 3 schedules and the second one have 4 schedules.
Can someone help on this matter.
Thanks for your time
Here is my VBA code for the subreport
Option Compare Database
Dim DateDebut As Date
Dim varOpenedOnce As Integer
-----------------------------------------------------------
Private Sub EntêteGroupe0_Format(Cancel As Integer, FormatCount As Integer)
Me.txtFirstDay = DateDebut
Me.txtSecondDay = DateDebut + 1
Me.txtThirdDay = DateDebut + 2
Me.txtFourthDay = DateDebut + 3
Me.txtFifthDay = DateDebut + 4
Me.txtSixthDay = DateDebut + 5
Me.txtSeventhDay = DateDebut + 6
Me.txtEighthDay = DateDebut + 7
End Sub
----------------------------------------------------------
Private Sub Report_Open(Cancel As Integer)
Dim strSQL As Variant
strSQL = ""
strSQL = Me.Parent.OpenArgs
If varOpenedOnce = 0 Then
If Not IsNothing(strSQL) Then
DateDebut = ExtractElement(strSQL, 2, "#")
Me.RecordSource = strSQL
varOpenedOnce = 1
End If
End If
End Sub
----------------------------------------------------------
Private Sub Détail_Format(Cancel As Integer, FormatCount As Integer)
Dim xwidth As Integer
xwidth = Me.txtClient.Width
Select Case ScheduleDate
Case txtFirstDay.Value
Me.txtClient.Left = 0
Me.txtDebutTime.Left = 0
Me.txtFinalTime.Left = 0
Case txtSecondDay.Value
Me.txtClient.Left = xwidth
Me.txtDebutTime.Left = xwidth
Me.txtFinalTime.Left = xwidth
Case txtThirdDay.Value
Me.txtClient.Left = xwidth * 2
Me.txtDebutTime.Left = xwidth * 2
Me.txtFinalTime.Left = xwidth * 2
Case txtFourthDay.Value
Me.txtClient.Left = xwidth * 3
Me.txtDebutTime.Left = xwidth * 3
Me.txtFinalTime.Left = xwidth * 3
Case txtFifthDay.Value
Me.txtClient.Left = xwidth * 4
Me.txtDebutTime.Left = xwidth * 4
Me.txtFinalTime.Left = xwidth * 4
Case txtSixthDay.Value
Me.txtClient.Left = xwidth * 5
Me.txtDebutTime.Left = xwidth * 5
Me.txtFinalTime.Left = xwidth * 5
Case txtSeventhDay.Value
Me.txtClient.Left = xwidth * 6
Me.txtDebutTime.Left = xwidth * 6
Me.txtFinalTime.Left = xwidth * 6
Case txtEighthDay.Value
Me.txtClient.Left = xwidth * 7
Me.txtDebutTime.Left = xwidth * 7
Me.txtFinalTime.Left = xwidth * 7
End Select
If (ScheduleDate >= txtFirstDay.Value And ScheduleDate <= txtEighthDay.Value) Then
Me.MoveLayout = False
End If
End Sub
I'm trying to do a report in the format of the image attached to this thread (the lower part of the image). It has employee information on the right side and schedule information on the left side (informations are ClientName, DebutTime, FinalTime). Each employee has many schedules. I wanted to have all schedules on the same line, so I used the Movelayout = False and the left property to place the schedule under it's date.
The user types the first day on a form and then the report opens. The schedule has been built as a subreport which is linked with the EmployeeID.
The problem is that some records don't show up on the preview, it seems the movelayout and the Canshrink, Cangrow are the culprits. Let me explain, with Movelayout = True, I can see each record on differents lines and when I start moving the textboxes, some records are seen partially (see top of image in attachment) and I would like the cangrow and canshrink to be false.
In the image, the first employee should have 3 schedules and the second one have 4 schedules.
Can someone help on this matter.
Thanks for your time
Here is my VBA code for the subreport
Option Compare Database
Dim DateDebut As Date
Dim varOpenedOnce As Integer
-----------------------------------------------------------
Private Sub EntêteGroupe0_Format(Cancel As Integer, FormatCount As Integer)
Me.txtFirstDay = DateDebut
Me.txtSecondDay = DateDebut + 1
Me.txtThirdDay = DateDebut + 2
Me.txtFourthDay = DateDebut + 3
Me.txtFifthDay = DateDebut + 4
Me.txtSixthDay = DateDebut + 5
Me.txtSeventhDay = DateDebut + 6
Me.txtEighthDay = DateDebut + 7
End Sub
----------------------------------------------------------
Private Sub Report_Open(Cancel As Integer)
Dim strSQL As Variant
strSQL = ""
strSQL = Me.Parent.OpenArgs
If varOpenedOnce = 0 Then
If Not IsNothing(strSQL) Then
DateDebut = ExtractElement(strSQL, 2, "#")
Me.RecordSource = strSQL
varOpenedOnce = 1
End If
End If
End Sub
----------------------------------------------------------
Private Sub Détail_Format(Cancel As Integer, FormatCount As Integer)
Dim xwidth As Integer
xwidth = Me.txtClient.Width
Select Case ScheduleDate
Case txtFirstDay.Value
Me.txtClient.Left = 0
Me.txtDebutTime.Left = 0
Me.txtFinalTime.Left = 0
Case txtSecondDay.Value
Me.txtClient.Left = xwidth
Me.txtDebutTime.Left = xwidth
Me.txtFinalTime.Left = xwidth
Case txtThirdDay.Value
Me.txtClient.Left = xwidth * 2
Me.txtDebutTime.Left = xwidth * 2
Me.txtFinalTime.Left = xwidth * 2
Case txtFourthDay.Value
Me.txtClient.Left = xwidth * 3
Me.txtDebutTime.Left = xwidth * 3
Me.txtFinalTime.Left = xwidth * 3
Case txtFifthDay.Value
Me.txtClient.Left = xwidth * 4
Me.txtDebutTime.Left = xwidth * 4
Me.txtFinalTime.Left = xwidth * 4
Case txtSixthDay.Value
Me.txtClient.Left = xwidth * 5
Me.txtDebutTime.Left = xwidth * 5
Me.txtFinalTime.Left = xwidth * 5
Case txtSeventhDay.Value
Me.txtClient.Left = xwidth * 6
Me.txtDebutTime.Left = xwidth * 6
Me.txtFinalTime.Left = xwidth * 6
Case txtEighthDay.Value
Me.txtClient.Left = xwidth * 7
Me.txtDebutTime.Left = xwidth * 7
Me.txtFinalTime.Left = xwidth * 7
End Select
If (ScheduleDate >= txtFirstDay.Value And ScheduleDate <= txtEighthDay.Value) Then
Me.MoveLayout = False
End If
End Sub