R
randria
Hello,
I have a form that supplies parameters to a query. I have 2 different
reports ( OSrpt and ONrpt ) depending on this query. I want to preview OSrpt
if the categorieID of the supplier selected by the user is equal to 1 and if
not to preview ONrpt instead.
this is the code I used but it selects only "ONrpt".
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim stDocName As String
Dim CategorieID As long
if CategorieID=1 Then
stDocName = "OSrpt"
DoCmd.OpenReport stDocName, acPreview
else
stDocName= "ONrpt"
DoCmd.OpenReport stDocName, acPreview
End if
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
the problem is that even if the 1st condition is true, it displays the
records on the report "ONrpt".
Many thanks.
randria
I have a form that supplies parameters to a query. I have 2 different
reports ( OSrpt and ONrpt ) depending on this query. I want to preview OSrpt
if the categorieID of the supplier selected by the user is equal to 1 and if
not to preview ONrpt instead.
this is the code I used but it selects only "ONrpt".
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim stDocName As String
Dim CategorieID As long
if CategorieID=1 Then
stDocName = "OSrpt"
DoCmd.OpenReport stDocName, acPreview
else
stDocName= "ONrpt"
DoCmd.OpenReport stDocName, acPreview
End if
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
the problem is that even if the 1st condition is true, it displays the
records on the report "ONrpt".
Many thanks.
randria