view/ print multi reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have five reports . want to make one form with multi-select list to select
one or more from the reports list .and i have one button which i want it to
do that thru code.
can any body help me with this code. i am getting this message now
"object doesnt support this property or method"

this is the code i have in the on click of the button

Private Sub Command4_Click()
On Error GoTo Err_Command4_Click

Dim stDocName As String

strDocName = Forms![View Reports].Form.[Command4]
strLinkCriteria = "[IDNO]=[Forms]![NEW CASES]![IDNO]"
DoCmd.OpenReport strDocName, , , strLinkCriteria

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

End Sub
 
Try this code to loop through the reports that are selected, and print them

Dim ctl As Control
Dim varItem As Variant
Dim strSQL As String, strDocName As string, strLinkCriteria As string

Set ctl = Me.lbMultiSelectListboxName
For Each varItem In ctl.ItemsSelected
strDocName = ctl.ItemData(varItem)
strLinkCriteria = "[IDNO]=[Forms]![NEW CASES]![IDNO]"
DoCmd.OpenReport strDocName, , , strLinkCriteria
Next varItem
 
Ofer said:
Try this code to loop through the reports that are selected, and print them

Dim ctl As Control
Dim varItem As Variant
Dim strSQL As String, strDocName As string, strLinkCriteria As string

Set ctl = Me.lbMultiSelectListboxName
For Each varItem In ctl.ItemsSelected
strDocName = ctl.ItemData(varItem)
strLinkCriteria = "[IDNO]=[Forms]![NEW CASES]![IDNO]"
DoCmd.OpenReport strDocName, , , strLinkCriteria
Next varItem
thank you for help.works perfect
thanks again
 
Back
Top