I need to list my report in a Combo Box (1 Viewer)

othmanyg

Registered User.
Local time
Today, 10:09
Joined
Feb 1, 2000
Messages
43
Hi, I have a database with almost 20 reports, so i need to put all these reports on a Drop-down list or a Combo Box, so once i selet any report from the Combo Box it opens up.

I highly appreciate the help.
 

R. Hicks

AWF VIP
Local time
Today, 04:09
Joined
Dec 23, 1999
Messages
619
You can use a combo box or a list box to do this. Below is a sample using a combo box.
Here I am using the On Current event of the form to populate the combo box.

Private Sub Form_Current()
Dim dbs As Database
Set dbs = CurrentDb
Dim ctr As Container
Dim cboList As String
Dim doc As Document

cboList = ""
Set ctr = dbs.Containers("Reports")

'build the value list for Reports
For Each doc In ctr.Documents
Debug.Print doc.Name
cboList = cboList & doc.Name & ";"
Next
'Load the Combo Box box
cboList = Left(cboList, Len(cboList) - 1) 'truncate the last semicolon
cboReports.RowSourceType = "Value List"
cboReports.RowSource = cboList
End Sub

HTH
RDH
 

Users who are viewing this thread

Top Bottom