Solved

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

Posted on 2013-12-06
2
789 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

760 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

18 Experts available now in Live!

Get 1:1 Help Now