A
ademitutu
Guest
I have two different types of reports to print, Narratives (name format eg: rptabcdefgh) and Summary (name format eg: sumijklmnop). Right now, all the reports show up in lstNarrativeList.RowSource. My intension is to separate the reports into two groups – Narratives and Summaries. I am hoping to populate lstNarrativeList.RowSource with Narative Reports only and lstSummaryList.RowSource with Summary Reports only.
Below is a modified code (thanks to Inside Microsoft Access) that I have been using and my form name is frmPrint Options.
Private Sub Form_Open (Cancel As Integer)
Dim db As Database, rpt As Document, cnt As Container
Dim strRowSrc As String, RepName As String
Set db = CurrentDb
Set cnt = db.Containers!Reports
For Each rpt In cnt.Documents
If Left(rpt.Name, 3) = "rpt" Then
RepName = Right(rpt.Name, Len(rpt.Name) - 3)
Else
End If
strRowSrc = strRowSrc & RepName & ";"
Next rpt
lstNarrativeList.RowSource = strRowSrc
Set cnt = Nothing
Set db = Nothing
End Sub
I have tried everything I can think of with no success. Can anyone out there help this inexperienced access user?
Thanks in advance.

Below is a modified code (thanks to Inside Microsoft Access) that I have been using and my form name is frmPrint Options.
Private Sub Form_Open (Cancel As Integer)
Dim db As Database, rpt As Document, cnt As Container
Dim strRowSrc As String, RepName As String
Set db = CurrentDb
Set cnt = db.Containers!Reports
For Each rpt In cnt.Documents
If Left(rpt.Name, 3) = "rpt" Then
RepName = Right(rpt.Name, Len(rpt.Name) - 3)
Else
End If
strRowSrc = strRowSrc & RepName & ";"
Next rpt
lstNarrativeList.RowSource = strRowSrc
Set cnt = Nothing
Set db = Nothing
End Sub
I have tried everything I can think of with no success. Can anyone out there help this inexperienced access user?
Thanks in advance.