Solved

Message box if one of two fields are blank

Posted on 2014-02-15
1
760 Views
Last Modified: 2014-02-15
I'm trying to make a message box appear if either of two fields on a form are blank.  If either one of then has data entered then the message box does not need to appear.  Here is my code.  But it's not working when both fields are left blank.

    If Nz(Me.txtIncomingQty, "") = "" Or Nz(Me.txtSoldQty, "") = "" Then
        MsgBox "You must enter both an incoming and a sold qty."
        Me.txtIncomingQty.SetFocus
        Exit Sub
0
Comment
Question by:SteveL13
1 Comment
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39861843
try, the message will appear IF BOTH are blank, is this what you want?

your statement above is confusing...

If Me.txtIncomingQty & Me.txtSoldQty & "" = "" Then
        MsgBox "You must enter either an incoming or a sold qty."
        Me.txtIncomingQty.SetFocus
        Exit Sub
end if
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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

803 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