inputbox to print 2 or less/more

  • Thread starter Thread starter adriany
  • Start date Start date
A

adriany

like to use inputbox to print 2 as default and 1 or more
as input. I don't know how that can be done!

help anyone

intCopies = InputBox("Enter number of copies
required", "PrintOut", 2)

If intCopies = 2 Then
DoCmd.OpenReport "Report", acViewNormal
DoCmd.OpenReport "Report", acViewNormal
Else
'????
 
I would code it this way:

intCopies = InputBox("Enter number of copies required", "PrintOut", 2)
if isnumeric(intCopies) then '(determines if the value entered is
actually a number)
do until intCopies = 0
docmd.openreport "Report", acviewnormal
intCopies = intcopies - 1
loop
end if

HTH
Kat
 
Or it can be coded this way (say you want more than 2... I don't know if
that's what the original poster wanted...?)

Dim PrintCopies as Integer
intCopies = InputBox("Enter the number of copies to print","Print Out",2)
PrintCopies = 0
If intCopies < 2 Then
MsgBox "Please select 2 or more copies"
Exit Sub
End If
Do Until PrintCopies = intCopies
DoCmd.OpenReport, "Report", acViewNormal
PrintCopies = PrintCopies + 1 'increments the
counter
Loop
Exit Do

HTH?
Gary
 
Back
Top