Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-12-06
2
Medium Priority
?
1,015 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 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