L
Leslie Isaacs
Hello All
I thuoght I had the answer to this from an earlier post (thank you Jeff
Conrad), but in trying to adapt it for my purpose I still get an error
'Duplicate declaration in current scope' with my second line of
"Err_Command677_Click:" highlighted - but I can't see what to do!
..
The problem is trying to handle the no-data error for two reports at the
same time. The code I have is:
Private Sub Command677_Click()
On Error GoTo Err_Command677_Click
Dim stDocName As String
If MsgBox("Do you want to print the Portrait version", vbYesNo + vbQuestion,
"WARNING") = vbNo Then
stDocName = "rpt P60 try 2004/05"
DoCmd.OpenReport stDocName, acPreview
stDocName = "rpt P60 try 2004/05 dcmonths"
DoCmd.OpenReport stDocName, acPreview
Err_Command677_Click:
If Err.number = 2501 Then
Resume Next
Else
'MsgBox Err.Description
End If
Else
stDocName = "rpt P60 try 2004/05 portrait"
DoCmd.OpenReport stDocName, acPreview
stDocName = "rpt P60 try 2004/05 portrait dcmonths"
DoCmd.OpenReport stDocName, acPreview
Err_Command677_Click:
If Err.number = 2501 Then
Resume Next
Else
'MsgBox Err.Description
End If
End If
Exit_Command677_Click:
Exit Sub
Resume Exit_Command677_Click
End Sub
Hope someone can help.
Many thanks
Leslie Isaacs
I thuoght I had the answer to this from an earlier post (thank you Jeff
Conrad), but in trying to adapt it for my purpose I still get an error
'Duplicate declaration in current scope' with my second line of
"Err_Command677_Click:" highlighted - but I can't see what to do!
..
The problem is trying to handle the no-data error for two reports at the
same time. The code I have is:
Private Sub Command677_Click()
On Error GoTo Err_Command677_Click
Dim stDocName As String
If MsgBox("Do you want to print the Portrait version", vbYesNo + vbQuestion,
"WARNING") = vbNo Then
stDocName = "rpt P60 try 2004/05"
DoCmd.OpenReport stDocName, acPreview
stDocName = "rpt P60 try 2004/05 dcmonths"
DoCmd.OpenReport stDocName, acPreview
Err_Command677_Click:
If Err.number = 2501 Then
Resume Next
Else
'MsgBox Err.Description
End If
Else
stDocName = "rpt P60 try 2004/05 portrait"
DoCmd.OpenReport stDocName, acPreview
stDocName = "rpt P60 try 2004/05 portrait dcmonths"
DoCmd.OpenReport stDocName, acPreview
Err_Command677_Click:
If Err.number = 2501 Then
Resume Next
Else
'MsgBox Err.Description
End If
End If
Exit_Command677_Click:
Exit Sub
Resume Exit_Command677_Click
End Sub
Hope someone can help.
Many thanks
Leslie Isaacs