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
| Option Compare Database
Private Sub Form_Current()
'photos
If Len(Me.OA_PHOTO) > 0 Then
Me.imgOUV.Picture = CurrentProject.Path & "\" & Me.OA_PHOTO
Else
Me.imgOUV.Picture = CurrentProject.Path & "\divers\blank.jpg"
End If
DisplayPhoto
'Affichage renseignements vannage/clapet/portes à flots/clapet anti-retour/batardeau/barrage/système anti-refoulement
If Me.OA_TYPE.Value = "bonde" Or Me.OA_TYPE.Value = "vanne" Then
Me.onglet_vanne.Visible = True
Me.onglet_buse.Visible = False
Me.onglet_deversoir.Visible = False
Me.onglet_plandeau.Visible = False
Me.onglet_pont.Visible = False
End If
'Affichage renseignements buse/passage busé
If Me.OA_TYPE.Value = "passage busé" Or Me.OA_TYPE.Value = "buse" Then
Me.onglet_vanne.Visible = False
Me.onglet_buse.Visible = True
Me.onglet_deversoir.Visible = False
Me.onglet_plandeau.Visible = False
Me.onglet_pont.Visible = False
End If
'Affichage renseignements déversoir/seuil naturel/seuil artificiel/seuil non maçonné/muret de parcelle/gué
If Me.OA_TYPE.Value = "chute naturelle" Or Me.OA_TYPE.Value = "déversoir" Or Me.OA_TYPE.Value = "brèche" Or Me.OA_TYPE.Value = "batardeau / seuil amovible" Then
Me.onglet_vanne.Visible = False
Me.onglet_buse.Visible = False
Me.onglet_deversoir.Visible = True
Me.onglet_plandeau.Visible = False
Me.onglet_pont.Visible = False
End If
'Affichage renseignement plan d'eau
If Me.OA_TYPE.Value = "mare sur cours" Or Me.OA_TYPE.Value = "plan d'eau" Then
Me.onglet_vanne.Visible = False
Me.onglet_buse.Visible = False
Me.onglet_deversoir.Visible = False
Me.onglet_plandeau.Visible = True
Me.onglet_pont.Visible = False
End If
'Affichage renseignements radier de pont
If Me.OA_TYPE.Value = "pont routier / dalot" Then
Me.onglet_vanne.Visible = False
Me.onglet_buse.Visible = False
Me.onglet_deversoir.Visible = False
Me.onglet_plandeau.Visible = False
Me.onglet_pont.Visible = True
End If
End Sub
Sub DisplayPhoto()
If Me.imgOUV.ImageHeight > Me.imgOUV.Height Then
Me.imgOUV.SizeMode = 3
Else
Me.imgOUV.SizeMode = 0
End If
If (Me.imgOUV.ImageWidth > Me.imgOUV.Width) And (Me.imgOUV.SizeMode) = 0 Then
Me.imgOUV.SizeMode = 3
End If
End Sub
Private Sub Commande33_Click()
Dim strLink As String
' Gestion des erreurs
On Error GoTo Catch01
'MsgBox CurrentProject.Path
' récupération du chemin physique de la photo
' par la boite de dialogue
strLink = OuvrirUnFichier(Me.Hwnd, _
"Sélectionner une image pour l'aperçu ", _
1)
' si la boite renvoie une adresse non nulle
If Len(strLink) > 0 Then
' tentative d'affichage de la photo
Me.imgOUV.Picture = GetRelativePath(strLink, CurrentProject.Path)
Me.OA_PHOTO = GetRelativePath(strLink, CurrentProject.Path)
End If
'MsgBox GetRelativePath(strLink, CurrentProject.Path)
DisplayPhoto
Exit Sub
Catch01:
Select Case Err.Number
Case 2114
'Cas d'un type de fichier photo non supporté ...
' on sort de la procédure
MsgBox "Le format de l'image n'est supporté par le contrôle image Picture", vbCritical + vbOKOnly, "Application Photos"
Exit Sub
Case 2220
'Cas d'un emplacement non valide du fichier images
MsgBox "Le fichier image n'a pas été trouvé à l'emplacement indiqué : " & vbCrLf & _
Me.OA_PHOTO, vbCritical + vbOKOnly, "Application Photos"
Exit Sub
Case Else
' tout autre cas d'erreur
MsgBox "Erreur inattendue : " & Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly, "Application Photos"
End Select
Err.Clear
End Sub
Private Sub btn_ajout_ouv_Click()
On Error GoTo Err_btn_ajout_ouv_Click
DoCmd.GoToRecord , , acNewRec
Exit_btn_ajout_ouv_Click:
Exit Sub
Err_btn_ajout_ouv_Click:
MsgBox Err.Description
Resume Exit_btn_ajout_ouv_Click
End Sub
Private Sub btn_precedent_Click()
On Error GoTo Err_btn_precedent_Click
DoCmd.GoToRecord , , acPrevious
Exit_btn_precedent_Click:
Exit Sub
Err_btn_precedent_Click:
MsgBox Err.Description
Resume Exit_btn_precedent_Click
End Sub
Private Sub btn_suivant_Click()
On Error GoTo Err_btn_suivant_Click
DoCmd.GoToRecord , , acNext
Exit_btn_suivant_Click:
Exit Sub
Err_btn_suivant_Click:
MsgBox Err.Description
Resume Exit_btn_suivant_Click
End Sub
Private Sub OA_TYPE_AfterUpdate()
Me.Requery
End Sub |
Partager