B
BMaerhofer
Private Sub SAVEForm_Click()
On Error GoTo Err_CloseForm_Click
If IsNull(Vehicle) Then
MsgBox "Must Select Vehicle for Entry before saving", vbOKOnly,
"Invalid Input"
End If
If IsNull(Date) Then
MsgBox "Must Enter Date for Entry before saving", vbOKOnly, "Invalid
Input"
End If
If IsNull(Mileage) Then
MsgBox "Must Enter Mileage for Entry before saving", vbOKOnly,
"Invalid Input"
End If
DoCmd.Close
Exit_CloseForm_Click:
Exit Sub
Err_CloseForm_Click:
MsgBox Err.Description
Resume Exit_CloseForm_Click
End Sub
The problem that I am having with this is that it will pop up the message if
the fields are not filled in that are required, but once you click "OK" for
the dialog boxes that pop up it will close the form instead of letting you
fill in the blanks then retry with saving. I need that fixed and can't
figure it out. (If false, return to form to fix data)
Also I am having problem with checkbox required fields.
I have 3 fields that have checkboxes that at least one is required, all
three can be checked as well.
Oil / Air / Other - At least one of these is required. I can't figure out
how to validate that one of these is checked before saving. I would like to
validate it like the coding above, but can't figure out how to write that.
Thanks,
Brian
On Error GoTo Err_CloseForm_Click
If IsNull(Vehicle) Then
MsgBox "Must Select Vehicle for Entry before saving", vbOKOnly,
"Invalid Input"
End If
If IsNull(Date) Then
MsgBox "Must Enter Date for Entry before saving", vbOKOnly, "Invalid
Input"
End If
If IsNull(Mileage) Then
MsgBox "Must Enter Mileage for Entry before saving", vbOKOnly,
"Invalid Input"
End If
DoCmd.Close
Exit_CloseForm_Click:
Exit Sub
Err_CloseForm_Click:
MsgBox Err.Description
Resume Exit_CloseForm_Click
End Sub
The problem that I am having with this is that it will pop up the message if
the fields are not filled in that are required, but once you click "OK" for
the dialog boxes that pop up it will close the form instead of letting you
fill in the blanks then retry with saving. I need that fixed and can't
figure it out. (If false, return to form to fix data)
Also I am having problem with checkbox required fields.
I have 3 fields that have checkboxes that at least one is required, all
three can be checked as well.
Oil / Air / Other - At least one of these is required. I can't figure out
how to validate that one of these is checked before saving. I would like to
validate it like the coding above, but can't figure out how to write that.
Thanks,
Brian