R
randria
Hello,
I have a cmd button in a form, 1 query, 2 different reports based on the
same query. Onclick of the button, a parameter is prompted and after
supplying a value the query runs. based the value that a field called
"Service" in the query, I would like access to select the right report. Below
is my codes but the problem is that it always picks the report named "Acc
voucher4". What is wrong with my codes ?
Private Sub Command63_Click()
On Error GoTo Err_Command63_Click
Dim stDocName As String
Dim Service As Long
Service = Service ' The field that shows the value of the service in
the query
If Service = 12 Then
stDocName = "Acc Voucher2"
DoCmd.OpenReport stDocName, acPreview
Else
stDocName = "Acc Voucher4"
DoCmd.OpenReport stDocName, acViewPreview
End If
Exit_Command63_Click:
Exit Sub
Err_Command63_Click:
MsgBox Err.Description
Resume Exit_Command63_Click
End Sub
I have a cmd button in a form, 1 query, 2 different reports based on the
same query. Onclick of the button, a parameter is prompted and after
supplying a value the query runs. based the value that a field called
"Service" in the query, I would like access to select the right report. Below
is my codes but the problem is that it always picks the report named "Acc
voucher4". What is wrong with my codes ?
Private Sub Command63_Click()
On Error GoTo Err_Command63_Click
Dim stDocName As String
Dim Service As Long
Service = Service ' The field that shows the value of the service in
the query
If Service = 12 Then
stDocName = "Acc Voucher2"
DoCmd.OpenReport stDocName, acPreview
Else
stDocName = "Acc Voucher4"
DoCmd.OpenReport stDocName, acViewPreview
End If
Exit_Command63_Click:
Exit Sub
Err_Command63_Click:
MsgBox Err.Description
Resume Exit_Command63_Click
End Sub