I have a problem trying to email a report from a form when using a filter.
I can preview the filtered report with the records filtered as the DoCmd.OpenReport accepts the strFilter as part of the Where clause see Case 2 below:
Select Case Me!grpFilterDrwgs
Case 1
DoCmd.OpenReport "RpDrwg", acViewPreview
Case 2
strFilter = "[PipeNo] = '" & Me!cboLineNo & "'"
DoCmd.OpenReport "RpDrwg", acViewPreview, , strFilter
End Select
It also works OK for printing. However, I can't find out hot to get the DoCmdSendObject to accept the strFilter. I can only send the complete report as in Case 1 below:
Select Case Me!grpFilterDrwgs
Case 1
DoCmd.SendObject acSendReport, "RpDrwg", acFormatSNP, , , , "Piping Drawing Data"
Case 2
strFilter = "[PipeNo] = '" & Me!cboLineNo & "'"
DoCmd.SendObject acSendReport, "RpDrwg", acFormatSNP, , , , "Piping Drawing Data"
End Select
Can anyone tell me how I can get Case 2 to accept the strFilter or is there any other way I can email the report with only the filtered data?
I can preview the filtered report with the records filtered as the DoCmd.OpenReport accepts the strFilter as part of the Where clause see Case 2 below:
Select Case Me!grpFilterDrwgs
Case 1
DoCmd.OpenReport "RpDrwg", acViewPreview
Case 2
strFilter = "[PipeNo] = '" & Me!cboLineNo & "'"
DoCmd.OpenReport "RpDrwg", acViewPreview, , strFilter
End Select
It also works OK for printing. However, I can't find out hot to get the DoCmdSendObject to accept the strFilter. I can only send the complete report as in Case 1 below:
Select Case Me!grpFilterDrwgs
Case 1
DoCmd.SendObject acSendReport, "RpDrwg", acFormatSNP, , , , "Piping Drawing Data"
Case 2
strFilter = "[PipeNo] = '" & Me!cboLineNo & "'"
DoCmd.SendObject acSendReport, "RpDrwg", acFormatSNP, , , , "Piping Drawing Data"
End Select
Can anyone tell me how I can get Case 2 to accept the strFilter or is there any other way I can email the report with only the filtered data?