PC Review


Reply
Thread Tools Rate Thread

Checking a forms fields for null

 
 
Mark
Guest
Posts: n/a
 
      27th May 2010
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
 
Reply With Quote
 
 
 
 
scott04
Guest
Posts: n/a
 
      27th May 2010

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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking for any null fields Jennifer Microsoft Access Queries 8 5th Oct 2009 09:06 PM
Checking for null fields before running query =?Utf-8?B?SnVhbiBDb3JyZWE=?= Microsoft Access VBA Modules 7 25th Jul 2007 04:48 PM
Error checking for table fields null value constraint tonyck Microsoft Access VBA Modules 0 17th Aug 2005 10:14 AM
Checking For Null DB Fields Troy Microsoft VB .NET 2 21st Aug 2003 09:49 PM
Checking For Null DB Fields Troy Microsoft ASP .NET 2 21st Aug 2003 09:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:18 PM.