Hi All
I am trying to check that all fields on a form are completed before allowing further processing to take place. I am using the code below but it is not working (doesn't seem to be reading the data from the form at all).
Private Sub Close_Click()
Dim rst As DAO.Recordset, intI, ErrCount As Integer
Dim FldName As String
Dim fld As Field
Set rst = Me.Recordset
ErrCount = 0
For Each fld In rst.Fields
' Check field values.
If IsNull(fld) Then
ErrCount = ErrCount + 1
FldName = fld.Name
MsgBox (FldName & " not entered. Please update " & FldName & ".")
Exit For
End If
Next
If ErrCount = 0 Then
DoCmd.Close acForm, "frmSTPCheck", acSaveYes
Call RepDataAdd
End If
End Sub
Please help a novice who is in over his head.
Thanks
I am trying to check that all fields on a form are completed before allowing further processing to take place. I am using the code below but it is not working (doesn't seem to be reading the data from the form at all).
Private Sub Close_Click()
Dim rst As DAO.Recordset, intI, ErrCount As Integer
Dim FldName As String
Dim fld As Field
Set rst = Me.Recordset
ErrCount = 0
For Each fld In rst.Fields
' Check field values.
If IsNull(fld) Then
ErrCount = ErrCount + 1
FldName = fld.Name
MsgBox (FldName & " not entered. Please update " & FldName & ".")
Exit For
End If
Next
If ErrCount = 0 Then
DoCmd.Close acForm, "frmSTPCheck", acSaveYes
Call RepDataAdd
End If
End Sub
Please help a novice who is in over his head.
Thanks