Listing database reports in list box

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

I have a function I got from the web that is supposed to populate a list box
with the reports that are in the system. When I create a new database and
use this function, I get the error message "USER DEFINED TYPE NOT DEFINED"
and it hightlights the "dim dbs as database" line of the function. I have
attached the full function below:

Private Sub Form_Load()
Dim dbs As Database, ctr As Container, doc As Document
Dim strTemp As String

Set dbs = CurrentDb
Set ctr = dbs.Containers!reports
For Each doc In ctr.Documents
strTemp = strTemp & """" & doc.name & """;"
Next doc
cbosystemreports.RowSource = strTemp

End Sub

Does anyone know what I have to do to make this work? Thanks

- joe
 
Joe

Sounds like you've got a missing reference.

With the VB window open click Tools ---> References and then look down the
list for Microsoft DAO X.X Object Library (where X.X is a number). Tick the
box next to it and then hit OK

This should enable you to use the code.

HTH

Andy W
 
Back
Top