Solved

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

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

Technology Partners: 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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

696 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