From: Mark on
Hi All,

I can think of a few ways to accomplish this, but would like to know of a
better way.

just like when you fill out forms on the web if the field is mandatory it
pops up a msg say somthing like "This field isn't optional" if it is left
blank. What is the best way to do this in access on a form?

I'm using now:

if ISNull(myFeild1) then
msgbox"Please fill in myFeild1"
end if
If ISNull(myFeild2) then
msgbox"Please fill in myFeild2"
end if
if ISNull(myFeild3) then
msgbox"Please fill in myFeild3"
end if
From: scott04 on

I use something similar to what you are suggesting however my validation if
more than one field is null it will list all the fields that are null. I
chopped a small bit of it below.

Dim strMsg As String

If IsNull(Me.Audit_nme) Then
Cancel = True
strMsg = strMsg & "Audit Name required." & vbCrLf
End If
If IsNull(Me.Combo61) Then
Cancel = True
strMsg = strMsg & "Auditor required." & vbCrLf
End If
If IsNull(Me.DateAudit) Then
Cancel = True
strMsg = strMsg & "Date Initiated." & vbCrLf
End If
If Cancel Then
strMsg = strMsg & vbCrLf & "Correct the entry, or press <Esc> to
undo."
MsgBox strMsg, vbExclamation, "Invalid entry"
End If
"Mark" wrote:

> Hi All,
>
> I can think of a few ways to accomplish this, but would like to know of a
> better way.
>
> just like when you fill out forms on the web if the field is mandatory it
> pops up a msg say somthing like "This field isn't optional" if it is left
> blank. What is the best way to do this in access on a form?
>
> I'm using now:
>
> if ISNull(myFeild1) then
> msgbox"Please fill in myFeild1"
> end if
> If ISNull(myFeild2) then
> msgbox"Please fill in myFeild2"
> end if
> if ISNull(myFeild3) then
> msgbox"Please fill in myFeild3"
> end if