Solved

Is Null

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

Accepted Solution

by:
Rey Obrero 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server views 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 Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now