J'ai le code suivant :
Lorsque l'utilisateur n'a pas encore touché au champ du nom de loi, sa valeur est a nothing, et c'est ce qui occasionne l'erreur. Comment faire pour corriger?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 Private Sub btnAjoutDocLoi_Click() On Error GoTo Err_btnAjoutDocLoi_Click If Not IsNull(Me.txtNomLoi.Value) Or Me.txtNomLoi.Value <> "" Then NoExigence = lenoexigence lasection = "Loi" litem = Me.txtNomLoi.Value DoCmd.OpenForm "frmAddDocumentsExigence", acNormal Else MsgBox "Vous devez entrer un nom de loi pour y ajouter des documents.", vbCritical, "Nom de loi" Me.txtNomLoi.SetFocus End If Exit_btnAjoutDocLoi_Click: Exit Sub Err_btnAjoutDocLoi_Click: MsgBox Err.Description Resume Exit_btnAjoutDocLoi_Click End Sub
Partager