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
Solved

Message box if one of two fields are blank

Posted on 2014-02-15
1
762 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

839 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