Message Box

S

Simon

I have a shop Database that invoives order

I have a Invoice button that runs code to print an invoice.Before it
print the code i want a message box to aprear if me.Outstanding on the
fom is great than £0.01 to bring up a message and say are you sure you
want to print out invoice as full payment has not been made

If you click OK its carray on and runs the print invoice code, if you
click No is just goes back to the order

Thanks
 
A

Arvin Meyer [MVP]

Assuming that the textbox on the form is named Outstanding, add the
following to the button, before the code which prints the invoice:

If Me.Outstanding > 0.01 Then
If MsgBox (" Are you sure you want to print out invoice as full payment
has not been made", vbYesNo, "Print Invoice?") = vbNo Then
Exit Sub
End If
End If
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I have a shop Database that invoives order

I have a Invoice button that runs code to print an invoice.Before it
print the code i want a message box to aprear if me.Outstanding on the
fom is great than £0.01 to bring up a message and say are you sure you
want to print out invoice as full payment has not been made

If you click OK its carray on and runs the print invoice code, if you
click No is just goes back to the order

Thanks
 
J

John Spencer

Modify the code that the invoice button is using.

Dim tfPrint as Boolean: tfPrint = True

If Me.Outstanding > .01 Then
If vbyes <> _
MsgBox ("Money still owed" & vbcrlf & _
"Print anyway?", vbYesNo) Then tfPrint = False
End If

If tfPrint then
'Current code to print the report goes here.
'Probably something like
DoCmd.OpenReport "InvoiceReport", acViewNormal
End If

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top