M
Mike
Hi,
The following code triggers a report based on two combos and works fine.
I'd like to send the same report via email, so I changed the DoCmd but didn't
do the trick. What am I missing?
TIA,
Mike
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
Dim strSQL As String
Dim strCriteria As String
stDocName = "REPORT1"
If Me!type.Column(0) <> "" Or Me!series.Column(0) <> "" Then
'The line below doesn't work
DoCmd.SendObject acReport, stDocName, , " [CONTRACT_ID] = " &
Me!type.Column(0) & _
" and [TYPE_CONTRACT_ID] = " & Me!series.Column(0)
'The line below works
'DoCmd.OpenReport stDocName, acViewPreview, , " [CONTRACT_ID] = " &
Me!type.Column(0) & _
" and [TYPE_CONTRACT_ID] = " & Me!series.Column(0)
Me!type = ""
Me!series = ""
End If
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
The following code triggers a report based on two combos and works fine.
I'd like to send the same report via email, so I changed the DoCmd but didn't
do the trick. What am I missing?
TIA,
Mike
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
Dim strSQL As String
Dim strCriteria As String
stDocName = "REPORT1"
If Me!type.Column(0) <> "" Or Me!series.Column(0) <> "" Then
'The line below doesn't work
DoCmd.SendObject acReport, stDocName, , " [CONTRACT_ID] = " &
Me!type.Column(0) & _
" and [TYPE_CONTRACT_ID] = " & Me!series.Column(0)
'The line below works
'DoCmd.OpenReport stDocName, acViewPreview, , " [CONTRACT_ID] = " &
Me!type.Column(0) & _
" and [TYPE_CONTRACT_ID] = " & Me!series.Column(0)
Me!type = ""
Me!series = ""
End If
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub