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
|
Option Compare Database
Private Sub bouton_nouveau_Click()
Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
MsgBox "AJOUT D'UN NOUVEL ENREGISTREMENT :" & vbCrLf & vbCrLf & "S'il s'agit d'un logement :" & vbCrLf & "- Indiquez le nom du programme/lotissement et le numéro du lot" _
& vbCrLf & "- Indiquez le type de logements (individuel, collectif...) et le nombre de logements" & vbCrLf & "- Choisir ""Pas dans le RIL"" à la fin." _
& vbCrLf & vbCrLf & "S'il s'agit d'un commerce :" & vbCrLf & "- Indiquer l'enseigne dans ""Complément""", vbInformation, "Saisie d'un nouvel enregistrement"
Application.TempVars.Add "ActiverModeVerif", 1
End Sub
Public Sub Form_BeforeUpdate(Cancel As Integer)
If Application.TempVars("ActiverModeVerif").Value = 1 Then
Application.TempVars.Add "verif_count", 0
If Not IsNull(Type_de_logements) Then
If Nombre_de_logements.Value = 0 Then
Application.TempVars.Add "verif_count", 1
Application.TempVars.Add "verif_1", "- Vous avez saisi 0 logement;"
End If
If IsNull(Statut_RIL) Then
Application.TempVars.Add "verif_count", 2
Application.TempVars.Add "verif_2", "- Vous n'avez pas défini le statut du RIL (par défaut il faut indiquer ""Pas dans le RIL"");"
End If
If IsNull(Programme) Then
Application.TempVars.Add "verif_count", 3
Application.TempVars.Add "verif_3", "- Vous n'avez pas indiqué de lotissements ou de programme;"
End If
End If
If Application.TempVars("verif_count").Value > 0 Then
If MsgBox("Vous avez indiqué saisir un logement. Toutefois :" & vbCrLf & vbCrLf & Application.TempVars("verif_1").Value & vbCrLf & Application.TempVars("verif_3").Value _
& vbCrLf & Application.TempVars("verif_2").Value & vbCrLf & vbCrLf _
& "Choisir ""Annuler"" pour modifier l'enregistrement, ou ""OK"" pour le valider en l'état.", vbQuestion + vbOKCancel, "Vérification de votre enregistrement") = vbCancel Then
Application.TempVars.RemoveAll
Application.TempVars.Add "ActiverModeVerif", 1
Cancel = True
Else
Application.TempVars.RemoveAll
End If
Else
If MsgBox("Avez-vous terminé votre enregistrement ?" & vbCrLf & "Choisir ""Annuler"" pour le modifier.", _
vbQuestion + vbOKCancel, "Validation requise") = vbCancel Then
Application.TempVars.RemoveAll
Application.TempVars.Add "ActiverModeVerif", 1
Cancel = True
Else
Application.TempVars.RemoveAll
End If
End If
End If
End Sub |
Partager