B
BMaerhofer
'Save Form with required fields
Private Sub SAVEForm_Click()
On Error GoTo Err_CloseForm_Click
If [Oil_Filter Change] Or [Air Filter Change] Or [Other Maintenance] =
True And [Mileage] Is Not Null And [Date] Is Not Null Then
DoCmd.Close
Else
MsgBox "Required Fields must not be blank before saving!"
End If
Exit_CloseForm_Click:
Exit Sub
Err_CloseForm_Click:
MsgBox Err.Description
Resume Exit_CloseForm_Click
Here is the problem: I need for the message to prompt the user if
[Mileage], [Date] and one of the following (Oil, Air, Other) is not filled in
before saving the record.
Example of choices:
1 [Oil_Filter Change], [Mileage], and [Date] required
2 [Air_Filter Change], [Mileage], and [Date] required
3 [Other Maintenance], [Mileage], and [Date] required
4 [Oil_Filter Change], [Air_Filter Change], [Mileage], and [Date] required
Summary: 3 minimum required fields (Mileage, Date and Oil or Air or Other)
It seems easy but for some reason I am struggling with this. Either it
closes and doesn't give you the opportunity to correct the required fields or
it give you an object dialog box.
Thanks,
Private Sub SAVEForm_Click()
On Error GoTo Err_CloseForm_Click
If [Oil_Filter Change] Or [Air Filter Change] Or [Other Maintenance] =
True And [Mileage] Is Not Null And [Date] Is Not Null Then
DoCmd.Close
Else
MsgBox "Required Fields must not be blank before saving!"
End If
Exit_CloseForm_Click:
Exit Sub
Err_CloseForm_Click:
MsgBox Err.Description
Resume Exit_CloseForm_Click
Here is the problem: I need for the message to prompt the user if
[Mileage], [Date] and one of the following (Oil, Air, Other) is not filled in
before saving the record.
Example of choices:
1 [Oil_Filter Change], [Mileage], and [Date] required
2 [Air_Filter Change], [Mileage], and [Date] required
3 [Other Maintenance], [Mileage], and [Date] required
4 [Oil_Filter Change], [Air_Filter Change], [Mileage], and [Date] required
Summary: 3 minimum required fields (Mileage, Date and Oil or Air or Other)
It seems easy but for some reason I am struggling with this. Either it
closes and doesn't give you the opportunity to correct the required fields or
it give you an object dialog box.
Thanks,