Solved

Is Null

Posted on 2011-03-01
8
240 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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

830 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