?
Solved

How make message box popup if certain criteria exists in a query

Posted on 2013-12-06
2
Medium Priority
?
971 Views
Last Modified: 2013-12-06
I have a form which has a field named txtPart_No.  When the user has made an entry in this textbox I want a message box to appear IF certain criteria exists.  First of all a query has to run that looks like the attachment.  The query is named "qryScrapPercentForLastThreeOrders"

Then IF any one of the records in the query has a "Scrap Percentage" that is 10.0% or greater, make the message box appear.

But the message box has to give the user the choice to either print a report (yet to be designed), or close the message box and proceed.

I don't know how to code the afterupdate event of the field txtPart_No

--Steve
3-Order-Query.jpg
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
2 Comments
 
LVL 15

Accepted Solution

by:
JimFive earned 2000 total points
ID: 39702258
Something like:
if DMax("ScrapPercentage","qryScrapPercentForLastThreeOrders") >= .1 then
    if messagebox("Do You want to proceed?", vbYesNo") = vbNo Then
        Cancel = true
        Exit Sub
    else
        proceed...
end if

Open in new window

0
 

Author Comment

by:SteveL13
ID: 39702272
It worked but I had to change it slightly to:

    If DMax("ScrapPercent", "qryScrapPercentForLastThreeOrders") >= 0.1 Then
        If MsgBox("Do You want to proceed?", vbYesNo) = vbNo Then
        Cancel = True
        Exit Sub
        Else
        MsgBox "report goes here"
        End If
    End If

Now I'm going to post another question title, "Another message box criteria question" which is very similar to this one.  The difference is in the 2nd paragraph.

--Steve
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses

764 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