Solved

Message box if one of two fields are blank

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

Accepted Solution

by:
Rey Obrero 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
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…
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

758 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

22 Experts available now in Live!

Get 1:1 Help Now