Macros opening reports

User Name

Registered User.
Local time
Today, 18:31
Joined
Jun 10, 2003
Messages
26
I want the user to be able to open anyone of the report that they want to. How do I prompt the user with options and get them to chose it, hence opening the report for them.
 
The easiest was is to use a form with a combo/listbox and populate the box with a list of reports. I have some code that will do this - If you cannot find any yourself, I'll post the code I use later on when I get back.
 
Can I see the code you used to do this. Also is there any sort of macro that will allow me to sort data by year so I don't have to put the year feild in a query.
 
Found it! - Place this on the OnLoad event of your form where the unbound listbox is.

Code:
Dim dbs As DAO.Database, ctr As Container, strList As String, doc As Document
strList = ""
Set dbs = CurrentDb
Set ctr = dbs.Containers("Reports")

'Create Value list for listbox
For Each doc In ctr.Documents
strList = strList & doc.Name & ";"
Next

'Populate List Box
strList = Left(strList, Len(strList) - 1) 'trim last ;
Me.NameofListbox.RowSourceType = "Value List"
Me.NameofListbox.RowSource = strList

where NameofListBox is the name of your listbox
 

Users who are viewing this thread

Back
Top Bottom