view/ print multi reports

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
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top