Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CONTAINER CODE FOR DROP DOWN REPORT LIST 1

Status
Not open for further replies.

Jamie2002

Technical User
Sep 17, 2001
62
GB
Can anyone provide this piece of code allowing a drop down box on a form to lookup report names/query names/table names using the container function.

Thanks.
 
Dim ct As Container
Dim doc As Document
Set ct = DB1.Containers("Forms")
For Each doc In ct.Documents
List3.AddItem (doc.Name)
Next doc

Set ct = DB1.Containers("Reports")
For Each doc In ct.Documents
List4.AddItem (doc.Name)
Next doc

Set ct = DB1.Containers("Scripts")
For Each doc In ct.Documents
List5.AddItem (doc.Name)
Next doc

Set ct = DB1.Containers("Modules")
For Each doc In ct.Documents
List6.AddItem (doc.Name)
Next doc
 
How do I type the DB1 name, as full path or in [] or ""...?
 
currentdb() or the full path and filename.
eg.
dim db1 as database
set db1 = currentdb()
 
It is returning an error message saying "Member or data member not found" in regard to ".additem"

This is the code I have added

Private Sub List172_BeforeUpdate(Cancel As Integer)

Dim ct As Container
Dim doc As Document
Dim db1 As Database

Set db1 = CurrentDb()
Set ct = db1.Containers("Forms")
For Each doc In ct.Documents
List172.AddItem (doc.Name)
Next doc


Can you help..........?
 
I'm sorry try this,

Dim ct As Container
Dim doc As Document
Dim db1 As Database
Dim FrmName As String, strRowSrc As String

Set db1 = CurrentDb()
Set ct = db1.Containers("Forms")
For Each doc In ct.Documents
FrmName = doc.Name
strRowSrc = strRowSrc & FrmName & ";"
Next doc

List172.RowSource = strRowSrc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top