Solved

Is Null

Posted on 2011-03-01
8
238 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 500 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

773 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