Solved

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

Posted on 2013-12-06
2
815 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
2 Comments
 
LVL 15

Accepted Solution

by:
JimFive earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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…

932 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

10 Experts available now in Live!

Get 1:1 Help Now