MsgBox

  • Thread starter Thread starter Steve Moss
  • Start date Start date
S

Steve Moss

When a report is open I have a MsgBox which also opens, asking "would you
like to print this document". If the operator Clicks on "no", then the
MsgBox disappears, if they Click on "Yes" another MsgBox opens asking "how
many copies would you like". is there a way to add field to this MsgBox into
which the user can input a number of copies they would like, and then for it
to produce the correct number.

Cheers Steve
 
You may want to try creating a pop-up form instead of a msgbox for this. In
the macro or vba where you currenlty have your MsgBox, replace it with an
OpenForm command. Make sure the forms properties are set to PopUp and Modal.

On the form you can have either an options box using buttons for Print or
Cancel, Yes or Now, whatever you fancy and an unbound textbox for the number
of copies. For the OnClick event of "Yes", use this code:

Dim intCopies as Integer

For intCopies = 1 to me.textbox
DoCmd.OpenReport "ReportName"
Next intCopies

And for the 'No' button, use the code:

DoCmd.Close acForm, "PopUpFormName"
 
Sure. In the code prior to the loop, type in this

If isnull(me.textbox)=true then
MsgBox("Surely, you would like at least ONE copy!")
Else:


then add an End If at the end of the code.
 
sorry a reply has taken so long, that forces only let us log on for a certain
lenght of time at certain times of the day. I will give it a go.
Many thanks
Steve
 
Steve, another suggestion on this, you may want to set the text box's default
value to 1.
 
Back
Top