Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Message box if one of two fields are blank

Posted on 2014-02-15
1
Medium Priority
?
792 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 120

Accepted Solution

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

721 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