Listing database reports in list box

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
 
A

Andy Williams

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top