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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fill Listbox with the Captions and names of all Reports

Status
Not open for further replies.

kpereira

Programmer
Jun 29, 2000
33
0
0
US
Can anyone give me some idea of how to fill a list box with the captions and names of all reports. I want to use this listbox as a selection of reports for printing.

Any help would be appreciated!!!!

Karen
 
You might be able to query the information (List of Reports) for the hidden system table MSysObjects. The "Type" field seems to have unique numeric identifiers for each type of object. The names of the reports ar also listed.
 
Got this from Beginning access 2000 VBA by wrox press:(useful book to have)

function listreports (fld as control, id as variant, row as variant,col as variant,code as variant)as variant

Dim objAO as accessobject
dim objCP as object
Static strReports () as string
Static intentries as integer

Select Case Code
Case acLBInitialize
intEntries= 0
Set objCP= application.currentProject

Redim strReports(objCP.allreports.count)
for each objAO in objCP.allreports
strReports(intentries)=objAO.name
Next objAO

listreports=inEntires

Case acLBOpen
listreports= timer
Case acLBGetRowCount
listreports= inEntries
Case aclbgetcolumncount
listreports=1
case aclbgetcolumnwidth
listreports= -1
case aclbgetformat

case aclbend

end select
end function

Call the function in the 'row source type' of the properties of the list box
ie Row Source Type ... listreports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top