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
|
Private Sub Imprimer_Click()
On Error GoTo ErrHandler
Dim StrRequete As String
Dim Nom_Etat As String
Dim BoolReponse As Boolean
'1) Récupération des enregistrements
'***********************************
If Not ModSQL.FctGetClauseWhereFicheIncident(StrRequete) Then
GoTo ExitHandler
End If
'2) Ouverture de l'état en mode aperçu
'*************************************
Nom_Etat = "FrmFormulaireIncident3"
DoCmd.OpenReport Nom_Etat, acViewPreview ', , , acDialog
'3) Mise en page
'***************
SendKeys "{f11}"
SendKeys "{f10}"
SendKeys "{F}"
SendKeys "{p}"
SendKeys "{right}"
SendKeys "{TAB}"
SendKeys "{right}"
SendKeys "{enter}"
'4) Confirmation de l'impression
'*******************************
DoEvents
BoolReponse = (MsgBox("Voulez vous imprimer l'enregistrement courant ?", vbInformation + vbYesNo + vbDefaultButton2, CstAppName) = vbYes)
If BoolReponse Then
DoCmd.PrintOut acSelection, 1, 1, , 1
End If
DoCmd.Close acReport, Nom_Etat, acSaveNo
ExitHandler:
Exit Sub
ErrHandler:
'Resume
MsgBox Err.Description, vbExclamation, CstAppName
Resume ExitHandler
End Sub |
Partager