A
Aliza Klein
Hi.
I would like to provide my user with a list of the available reports in a
drop-down combo that can then be selected and printed (after clicking on a
button).
Currently, to populate the combo (cbReports) I use a Value List as a
rowsource, get each report name and build a string with the names. The
problem is the resulting list is not alphabetized. I suspect there is a
more efficient way of doing this that would also result in an alphabetized
list.
Any suggestions? The following is the code I currently use:
-------------------------
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
'clear out the old list
cbReports.RowSourceType = "Value List"
cbReports.RowSource = ""
cbReports.Requery
sRpts = ""
For Each obj In dbs.AllReports
'get the name, make a string with the name and add it
If sRpts = "" Then
sRpts = obj.Name
Else
sRpts = sRpts + ";" + obj.Name
End If
Next obj
cbReports.RowSource = sRpts
cbReports.Requery
I would like to provide my user with a list of the available reports in a
drop-down combo that can then be selected and printed (after clicking on a
button).
Currently, to populate the combo (cbReports) I use a Value List as a
rowsource, get each report name and build a string with the names. The
problem is the resulting list is not alphabetized. I suspect there is a
more efficient way of doing this that would also result in an alphabetized
list.
Any suggestions? The following is the code I currently use:
-------------------------
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
'clear out the old list
cbReports.RowSourceType = "Value List"
cbReports.RowSource = ""
cbReports.Requery
sRpts = ""
For Each obj In dbs.AllReports
'get the name, make a string with the name and add it
If sRpts = "" Then
sRpts = obj.Name
Else
sRpts = sRpts + ";" + obj.Name
End If
Next obj
cbReports.RowSource = sRpts
cbReports.Requery