M
mhmaid
hi all,
I have one form with cbo to list reports, and two buttons one to preview ,
the other to print the selected report/s. Now I want to add one more button
to sent report to file, but i am unable to get it work.can someone help me
this is the code(I think the problem is in this line oCmd.OutputTo
acReport, stDocName, , strLinkCriteria )
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click
Dim ctl As Control
Dim varItem As Variant
Dim strSQL As String, strDocName As String, strLinkCriteria As String
Set ctl = Me.lstReports
For Each varItem In ctl.ItemsSelected
strDocName = ctl.ItemData(varItem)
strLinkCriteria = "[IDNO]=[Forms]![NEW CASES]![IDNO]"
DoCmd.OutputTo acReport, stDocName, , strLinkCriteria
Next varItem
Exit_Command8_Click:
Exit Sub
Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click
End Sub
same code i am using to print or preview reports and its working ok.
I have one form with cbo to list reports, and two buttons one to preview ,
the other to print the selected report/s. Now I want to add one more button
to sent report to file, but i am unable to get it work.can someone help me
this is the code(I think the problem is in this line oCmd.OutputTo
acReport, stDocName, , strLinkCriteria )
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click
Dim ctl As Control
Dim varItem As Variant
Dim strSQL As String, strDocName As String, strLinkCriteria As String
Set ctl = Me.lstReports
For Each varItem In ctl.ItemsSelected
strDocName = ctl.ItemData(varItem)
strLinkCriteria = "[IDNO]=[Forms]![NEW CASES]![IDNO]"
DoCmd.OutputTo acReport, stDocName, , strLinkCriteria
Next varItem
Exit_Command8_Click:
Exit Sub
Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click
End Sub
same code i am using to print or preview reports and its working ok.