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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
| Private Sub Cmd_imprime_Click()
If Lbl_Num_Borderau.Caption = "" Or Combo_dest.Text = "" Or (DataGrid_apercu.ApproxCount = 0 And Combo_type_brd.ListIndex <> 3) Then
msg = "Aucun bordereau séléctionné !"
Style = vbCritical + vbOKOnly
Title = "Impression impossible"
Response = MsgBox(msg, Style, Title, "Demo.hlp", 1000)
Exit Sub
End If
Select Case Combo_type_brd.ListIndex
Case 0:
If PremiereImpression = True Then
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataEnvironment1.rsborderau.Open
DataReport1.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataEnvironment1.rsborderau.Open 'ajouté
DataReport1.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataEnvironment1.rsborderau.Open 'ajouté
DataReport1.Refresh
Else
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
End If
DataReport1.Title = Lbl_ref_apercu.Caption & " " & Lbl_date_dp_apercu.Caption & " " & Lbl_localite_apercu.Caption & "-" & Lbl_dest_apercu.Caption & " " & Lbl_num_brd_apercu.Caption
DataReport1.Refresh
On Error GoTo passerimpression1
DataReport1.PrintReport
Form1.ZOrder 0
requette = "SELECT * From [BORDERAUX DEPART] WHERE cod_brd_dp = '" & Lbl_Num_Borderau.Caption & "'"
Set rsBrdImp = base.OpenRecordset(requette)
rsBrdImp.Edit
rsBrdImp!imp = True
rsBrdImp.Update
rsBrdImp.Close
passerimpression1:
DataEnvironment1.rsborderau.Close
PremiereImpression = False
GoTo fnslct
Case 1:
If PremiereImpression = True Then
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataEnvironment1.rsborderau.Open
DataReport2.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
' DataReport2.Refresh
' DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataEnvironment1.rsborderau.Open
DataReport2.Refresh
Else
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
End If
DataReport2.Title = Lbl_ref_apercu.Caption & " " & Lbl_date_dp_apercu.Caption & " " & Lbl_localite_apercu.Caption & "-" & Lbl_dest_apercu.Caption & " " & Lbl_num_brd_apercu.Caption
'DataEnvironment1.rsborderau.Open 'ajouté
DataReport2.Refresh
On Error GoTo passerimpression2
DataReport2.PrintReport
Form1.ZOrder 0
requette = "SELECT * From [BORDERAUX DEPART] WHERE cod_brd_dp = '" & Lbl_Num_Borderau.Caption & "'"
Set rsBrdImp = base.OpenRecordset(requette)
rsBrdImp.Edit
rsBrdImp!imp = True
rsBrdImp.Update
rsBrdImp.Close
passerimpression2:
DataEnvironment1.rsborderau.Close
PremiereImpression = False
GoTo fnslct
Case 2:
If PremiereImpression = True Then
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataEnvironment1.rsborderau.Open
DataReport3.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataReport3.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataReport3.Refresh
Else
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
End If
DataReport3.Title = Lbl_ref_apercu.Caption & " " & Lbl_date_dp_apercu.Caption & " " & Lbl_localite_apercu.Caption & "-" & Lbl_dest_apercu.Caption & " " & Lbl_num_brd_apercu.Caption
DataReport3.Refresh
On Error GoTo passerimpression3
DataReport3.PrintReport
Form1.ZOrder 0
requette = "SELECT * From [BORDERAUX DEPART] WHERE cod_brd_dp = '" & Lbl_Num_Borderau.Caption & "'"
Set rsBrdImp = base.OpenRecordset(requette)
rsBrdImp.Edit
rsBrdImp!imp = True
rsBrdImp.Update
rsBrdImp.Close
passerimpression3:
DataEnvironment1.rsborderau.Close
PremiereImpression = False
GoTo fnslct
Case 3:
If PremiereImpression = True Then
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataEnvironment1.rsborderau.Open
DataReport4.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataReport4.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataReport4.Refresh
Else
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
End If
DataReport4.Refresh
On Error GoTo passerimpression4
DataReport4.PrintReport
Unload DataReport4
requette = "SELECT * From [BORDERAUX DEPART] WHERE cod_brd_dp = '" & Lbl_Num_Borderau.Caption & "'"
Set rsBrdImp = base.OpenRecordset(requette)
rsBrdImp.Edit
rsBrdImp!imp = True
rsBrdImp.Update
rsBrdImp.Close
passerimpression4:
DataEnvironment1.rsborderau.Close
PremiereImpression = False
GoTo fnslct
Case 4:
If PremiereImpression = True Then
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataEnvironment1.rsborderau.Open
DataReport5.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataReport5.Refresh
DataEnvironment1.rsborderau.Close
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
DataReport5.Refresh
Else
DataEnvironment1.rsborderau.Source = "SHAPE {SELECT * from [BORDERAUX DEPART], Sites where cod_dest = cod_site AND cod_brd_dp= '" & Lbl_Num_Borderau.Caption & "'} AS borderau APPEND ({Select * from Courriers, Sites where Courriers.cod_exp = Sites.cod_site ORDER BY Courriers.ordre} AS Courriers RELATE 'cod_brd_dp' TO 'cod_brd_dp') AS Courriers"
End If
DataReport5.Title = Lbl_ref_apercu.Caption & " " & Lbl_date_dp_apercu.Caption & " " & Lbl_localite_apercu.Caption & "-" & Lbl_dest_apercu.Caption & " " & Lbl_num_brd_apercu.Caption
DataReport5.Refresh
On Error GoTo passerimpression5
DataReport5.PrintReport
Form1.ZOrder 0
requette = "SELECT * From [BORDERAUX DEPART] WHERE cod_brd_dp = '" & Lbl_Num_Borderau.Caption & "'"
Set rsBrdImp = base.OpenRecordset(requette)
rsBrdImp.Edit
rsBrdImp!imp = True
rsBrdImp.Update
rsBrdImp.Close
passerimpression5:
DataEnvironment1.rsborderau.Close
PremiereImpression = False
GoTo fnslct
fnslct:
End Select
End Sub |
Partager