PC Review


Reply
Thread Tools Rate Thread

Check for null fields after certain date

 
 
=?Utf-8?B?QWxleA==?=
Guest
Posts: n/a
 
      9th Jun 2005
How can I write code in Before_Update that checks for the following:

If SDateField => 5/1/2005 then if DefectOneField > 0 and RMOneField is blank
then message or
if DefectTwoField > 0 and RMTwoField is blank then message or
if DefectThreeField > 0 and RMThreeField is blank then message or
on and on until DefectTenField > 0 and RMTenField is blank then message.

If SDateField < 5/1/2005 then nothing needs to be checked.

Thanks much -
 
Reply With Quote
 
 
 
 
David C. Holley
Guest
Posts: n/a
 
      9th Jun 2005
Why do you have multiple fields named DefectXXXField? Are all of these
fields in the same table? What data are you capturing in the field?

Alex wrote:
> How can I write code in Before_Update that checks for the following:
>
> If SDateField => 5/1/2005 then if DefectOneField > 0 and RMOneField is blank
> then message or
> if DefectTwoField > 0 and RMTwoField is blank then message or
> if DefectThreeField > 0 and RMThreeField is blank then message or
> on and on until DefectTenField > 0 and RMTenField is blank then message.
>
> If SDateField < 5/1/2005 then nothing needs to be checked.
>
> Thanks much -

 
Reply With Quote
 
=?Utf-8?B?QWxleA==?=
Guest
Posts: n/a
 
      9th Jun 2005
Yes, I have 22 fields in the same table with the names DefectXXXField. This
database is for a manufacturer and each record is for a part where there can
be up to 22 locations where there can be a defect of a number of inches. If
there's a defect, a user needs to choose whether the defect was done by a
robot or manual. When saving the form, I need a message to appear if there
are defects greater than 0 and Robot or Manual is not selected. This only
applies to records dated after May 1, 2005.

"David C. Holley" wrote:

> Why do you have multiple fields named DefectXXXField? Are all of these
> fields in the same table? What data are you capturing in the field?
>
> Alex wrote:
> > How can I write code in Before_Update that checks for the following:
> >
> > If SDateField => 5/1/2005 then if DefectOneField > 0 and RMOneField is blank
> > then message or
> > if DefectTwoField > 0 and RMTwoField is blank then message or
> > if DefectThreeField > 0 and RMThreeField is blank then message or
> > on and on until DefectTenField > 0 and RMTenField is blank then message.
> >
> > If SDateField < 5/1/2005 then nothing needs to be checked.
> >
> > Thanks much -

>

 
Reply With Quote
 
John Spencer (MVP)
Guest
Posts: n/a
 
      10th Jun 2005
Tedious.

Dim sMsg as String

IF SDateField >= #5/1/2005# then
IF DefectOneField > 0 and IsNull(RMOneField) THEN
SMsg = sMsg & vbcrlf & "Your Message Here"
End IF


IF DefectTwoField > 0 and IsNull(RMTWOField) THEN
SMsg = sMsg & vbcrlf & "Your Message Here"
END IF

....

If Len(sMsg)> 0 then
MsgBox SMsg
Cancel = True
END IF



Alex wrote:
>
> How can I write code in Before_Update that checks for the following:
>
> If SDateField => 5/1/2005 then if DefectOneField > 0 and RMOneField is blank
> then message or
> if DefectTwoField > 0 and RMTwoField is blank then message or
> if DefectThreeField > 0 and RMThreeField is blank then message or
> on and on until DefectTenField > 0 and RMTenField is blank then message.
>
> If SDateField < 5/1/2005 then nothing needs to be checked.
>
> Thanks much -

 
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
if date field not null or >0 check check box JK Microsoft Access VBA Modules 4 28th Jan 2009 03:44 PM
Looping across fields to check for null values Nicole Microsoft Access VBA Modules 1 11th Dec 2007 06:19 PM
date field is Null but only if 2 other dates fields are not Null =?Utf-8?B?SmFtaWVN?= Microsoft Access Queries 5 17th Apr 2006 06:14 PM
How would I set up code to check all null fields? Dave R. Microsoft Access 5 24th Jun 2005 09:36 PM
Check ALL fields for null =?Utf-8?B?U2hlbA==?= Microsoft Access Form Coding 2 1st Mar 2005 07:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:38 AM.