InputBox

M

Mike Revis

Hi Group,
Access 2000 win xppro

I have a command button on my form to print labels.
I would like to have an input box to enter the quantity of labels to print.

The code below is as far as I've gotten. It doesn't work. I should say the
inputBox part works.
I can't figure out how to get the quantity entered to give me that many
copies.


Private Sub cmdPrintLabel_Click()
On Error GoTo Err_cmdPrintLabel_Click

Dim stDocName As String

stDocName = "rpt4UpLabel"
InputBox "Enter quantity to print", "Label Quantity"
DoCmd.OpenReport stDocName, acViewPreview

Exit_cmdPrintLabel_Click:
Exit Sub

Err_cmdPrintLabel_Click:
MsgBox Err.Description
Resume Exit_cmdPrintLabel_Click

End Sub

As always any thoughts, comments or suggestions are welcome.

regards
Mike
 
L

Linq Adams via AccessMonster.com

Private Sub cmdPrintLabel_Click()
On Error GoTo Err_cmdPrintLabel_Click

Dim stDocName As String

stDocName = "rpt4UpLabel"
Copies = Val(InputBox("Enter quantity to print", "Label Quantity"))
If Copies > 0 Then
For i = 1 To Copies
DoCmd.OpenReport stDocName, acViewNormal
Next i
End If

Exit_cmdPrintLabel_Click:
Exit Sub

Err_cmdPrintLabel_Click:
MsgBox Err.Description
Resume Exit_cmdPrintLabel_Click

End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 

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