I've recently migrated a database from Access 2003 to 2007. I have a piece of code that uses an input box to ask the user how many copies of a report they want printed, I then use a Do While loop to print the required number. The code then carries on the execute the rest of the code. Everything worked fine in '03, but now in '07, after the first copy of the report is printed, the code stops executing completely. In other words, it drops out of the Do While, even though the user asked for multiple copies, and drops out of the Sub completely. If the user presses cancel or enters 0 the code after the print command executes just fine.
Here's the piece of code :-
BeepOnce
varPrintCopies = InputBox(vbCr & vbCr & "How many copies of the Admission Sheet " & vbCr & vbCr & " do you want to print?", strTitle, 1)
If varPrintCopies = "" Or varPrintCopies = 0 Then
BeepOnce
intMsgResponse = MsgBox(" No Admission Sheet will be printed!" & vbCr & vbCr & " Is that OK?", vbYesNo + vbQuestion, strTitle)
If intMsgResponse = vbNo Then
GoTo Ask_Again
Else
GoTo More
End If
Else
If varPrintCopies <> "" Then
If Not IsNumeric(varPrintCopies) Or varPrintCopies > 5 Then
BeepOnce
MsgBox "Number must be between 1 and 5", vbOKOnly, strTitle
GoTo Ask_Again
End If
Else
varPrintCopies = 1
End If
DoCmd.SetWarnings True
Do Until varPrintCopies = 0
intReportFilter = intPatientID
DoCmd.OpenReport "rptAdmissionSheet", acViewNormal
varPrintCopies = varPrintCopies - 1
Loop
More:
BeepOnce
intMsgMorePatients = MsgBox(" The new patient has been added to the database." & vbCr & vbCr & vbLf & " Do you want to add another?", vbYesNo + vbQuestion, strTitle)
' Reset the variable telling us if data has been entered in the finders detail
frmDataEntered = False
blnDataEntered = False
End If
Anyone else come across this and solved it?