Is Null

experts,
I have a form with records.
If [InvoiceDate] or [ExpectedDateRecCash] are Null then I need a msgbox
This is on the tab out of the record.  

How could i do this?

thank you.
pdvsaProject financeAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
try using the beforeupdate event of the form

private sub form_beforeUpdate(cancel as integer)

if isnull([InvoiceDate]) or IsNull([ExpectedDateRecCash]) then
   msgbox "message here:
   cancel=true
end if

end sub
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:


If IsNull( me.[InvoiceDate]) or IsNull(Me.[ExpectedDateRecCash]) Then
    msgbox "your message here"
End If

mx
0
 
pdvsaProject financeAuthor Commented:
Mx, Cap:  I really need to have it on the exit of the record.
Cap:  I tried BeforeUpdate and it is not exactly the answer.  

Is there code for on exit of the record?  
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Jeffrey CoachmanMIS LiasonCommented:
FWIW.

Cap has been around a long time.
;-)

Trust me, as inconvenient as it seems, you "Should" have this code on the Before Update event, as Cap states.

Putting it On Exit seems like a great idea, but this depends on how the user tabs through the fields (and when they make changes).
Using Before update will catch "all" the fields, right before the record is committed.

Just like on a web site...
You fill in *all* the fields, then click "Next" .
*Then* they pop up a screen telling you what fields had invalid data.

Access should work the same way.

But if your extensive experience in Database design tells you that you must violate this most basic principle, then this will be up to you.

JeffCoachman
0
 
Jeffrey CoachmanMIS LiasonCommented:
I am not expecting any points for my above post, I am simply agreeing with capricorn1's post.
;-)
JeffCoachman
0
 
Jeffrey CoachmanMIS LiasonCommented:
oops, sorry:

Please substitute "Capricron1" with "DatabaseMX and capricorn1"

;-)

Jeff
0
 
pdvsaProject financeAuthor Commented:
Jeff:  I see my error now.  I had another event on the field and it was firing when tabbing out of the field (not to another record) and the msgboxes were similar so I thought the BeforeUpdate event was firing but it was really another event.  I had two pieces of code working and I needed to remove one of them.  All is good now.

BeforeUpdate works
0
 
Jeffrey CoachmanMIS LiasonCommented:
;-)
0
All Courses

From novice to tech pro — start learning today.