[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Is Null

Posted on 2011-03-01
8
Medium Priority
?
250 Views
Last Modified: 2012-05-11
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.
0
Comment
Question by:pdvsa
8 Comments
 
LVL 75
ID: 35007779


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

mx
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 35007802
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
 

Author Comment

by:pdvsa
ID: 35008465
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35008593
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35008610
I am not expecting any points for my above post, I am simply agreeing with capricorn1's post.
;-)
JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35008644
oops, sorry:

Please substitute "Capricron1" with "DatabaseMX and capricorn1"

;-)

Jeff
0
 

Author Comment

by:pdvsa
ID: 35009385
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35009761
;-)
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question