Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Message box if one of two fields are blank

Posted on 2014-02-15
1
Medium Priority
?
797 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

971 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