The open report action is performed with a macro applying a filter: [SendReport_qry]![MailReceiver]=[Forms]![SendReport_selectset_frm]![MailSelect_lst]
I´d like to loop all records in the list and for each record open the report and send it to the mail address in the listbox. I have found a code to loop the records but it does not seam to actually select each record, as when i run the macro it opens the first filtered results over and over.
Can anyone help me to figure out how to do this?
Expand|Select|Wrap|Line Numbers
- Private Sub CreatePersonalReport_bttn_Click()
- Dim i As Long
- 'for looping listbox entries
- For i = 0 To Me.MailSelect_lst.ListCount - 1
- 'select if You want
- Me.MailSelect_lst.selected(i) = True
- MsgBox Me.MailSelect_lst.Column(0, i), vbOKOnly, "Item number: " & i + 1
- ' how do i open the filtered report and send it to the mailadress in the list instead of just generating a message?
- Next i
- 'end of listbox entries
- i = Me.MailSelect_lst.ListCount - 1
- MsgBox "Last row: " & i + 1, vbOKOnly, "Your reports has been created"
- End Sub