How to use a form to retrieve reports?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Background: I have a DB that has a form allowing users to construct
relatively simple surveys. Based on the questions selected through the form,
the DB constructs the survey as a report that the user can print, duplicate,
and pass out at meetings, trainings, events, etc. They can save these
"Reports", or form output, to the database.

My problem: I have a switchboard and I want a switchboard item to retrieve
the LIST of reports saved to the DB or take users to a form that contains the
list of reports where they can select a report to retrieve. How can I get
the list of reports (for users to select from) on a form? I cannot
pre-select the reports, because users will be creating/saving new reports all
the time and I cannot monitor when new ones are added in order to update the
list. I do not want users to access the DB navigation window to retrieve the
reports.

Can anyone suggest a remedy?
Thanks!
 
I use this code to list all reports in the database. Place this code
in the a module:

Function GetObjects(ctl As Control, varID As Variant, _
varRow As Variant, varCol As Variant, varCode As Variant)
Static db As Database
Static docs As Documents
Dim strType As String

Select Case varCode
Case acLBInitialize
Set db = CurrentDb()
strType = "Reports"
Set docs = db.Containers(strType).Documents
GetObjects = (docs.Count > 0)
Case acLBOpen
GetObjects = Timer
Case acLBGetRowCount
GetObjects = docs.Count
Case acLBGetValue
GetObjects = docs(varRow).Name
End Select
End Function

Now create a form and place a list box on the form. Put this in the
row source type, GetObjects

I don't remember where I got the code, but it works.
 
Back
Top