Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Report Print, Open Next Print 1

Status
Not open for further replies.

cretanion

Technical User
Jan 28, 2002
53
US
I am using the "Build Report Criteria via a Form w/list box, text box, date range faq181-5497" and I have the Listbox with "Month" and another Listbox with "Choose a name". The Listbox choices "Choose a name" can be Multi Select.
How do I get the Commmand Button to run a report Using the "Month" chosen and the Name Choice, run that report, then go to the next Name and run the report. Right now if I Multi Select it puts all the Names in one Report.

Any help would be appreciated.
 
Maybe this code can help you. I have a listbox with some property names. Next to it I have a Label as long as the listbox that will show which reports have been printed as the process goes along. This is not necessary, but the user liked it. In the following, mmclist is the listbox and NowPrinting is the label and MMCNumber is property name.

Private Sub Command6_Click()
Dim stDocName As String
stDocName = "Property_Manager_With_Data4"
Dim frm As Form, ctl As Control
Dim varItm As Variant
Dim strList As String
Dim strList2 As String
strList = ""
Set frm = Forms![MultiSelect_PropertyManager_Form]
Set ctl = frm![mmclist]
For Each varItm In ctl.ItemsSelected
strList = "'" & ctl.ItemData(varItm) & "'"
strList2 = strList2 & "'" & ctl.ItemData(varItm) & "'" & ", "
DoCmd.OpenReport stDocName, acNormal, , "[MMCNumber] IN (" & strList & ")"

' Debug.Print ctl.ItemData(varItm)
Me![NowPrinting].Caption = strList2
Next varItm
End Sub
 
Great response, I had to adjust to my report and it work great what you suggested.

Thank you!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top