By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,490 Members | 896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,490 IT Pros & Developers. It's quick & easy.

Fill Reports

P: n/a
Hello to all,

I am trying to fill all my reports in a listbox but I may not need
to show other reports. How do you modify this function to do that. I have
losts of reports but don't want to show all of them. I need to exculed certain
reports from the list box.

Public Function EnumReports(fld As Control, id As Variant, row As Variant, col
As Variant, code As Variant) As Variant
' Purpose: Supplies the name of all saved reports to a list box.
' Usage: Set the list box's RowSourceType property to: EnumReports
' leaving its RowSource property blank.
' Notes: All arguments are provided to the function automatically.
Dim db As Database, dox As Documents, i As Integer
Static sRptName(255) As String ' Array to store report names.
Static iRptCount As Integer ' Number of saved reports.
' Respond to the supplied value of "code".
Select Case code
Case acLBInitialize ' Called once when form opens.
Set db = CurrentDb()
Set dox = db.Containers!Reports.Documents
iRptCount = dox.Count ' Remember number of reports.
For i = 0 To iRptCount - 1
sRptName(i) = dox(i).Name ' Load report names into array.
Next
EnumReports = True
Case acLBOpen
EnumReports = Timer ' Return a unique identifier.
Case acLBGetRowCount ' Number of rows
EnumReports = iRptCount
Case acLBGetColumnCount ' 1 column
EnumReports = 1
Case acLBGetColumnWidth ' 2 inches
EnumReports = 2 * 1440
Case acLBGetValue ' The report name from the
array.
EnumReports = sRptName(row)
Case acLBEnd
Erase sRptName ' Deallocate array.
iRptCount = 0
End Select
End Function

thanks for any help
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try the rowsource of the listbox

SELECT msysobjects.Name FROM msysobjects WHERE (((Left([Name],3))<>"Sub")
AND ((msysobjects.Type)=-32764) AND ((Left([Name],7))<>"OTWTemp"));

1 column, bound column = 1

This does not show reports belining with "Sub" or "OTWTemp" to omit sub
reports and some special reports.
AK2, but I think it will work with earlier versions of Access.
HTH
Phil
"KEVIN97810" <ke********@aol.com> wrote in message
news:20***************************@mb-m12.aol.com...
Hello to all,

I am trying to fill all my reports in a listbox but I may not
need
to show other reports. How do you modify this function to do that. I
have
losts of reports but don't want to show all of them. I need to exculed
certain
reports from the list box.

Public Function EnumReports(fld As Control, id As Variant, row As Variant,
col
As Variant, code As Variant) As Variant
' Purpose: Supplies the name of all saved reports to a list box.
' Usage: Set the list box's RowSourceType property to: EnumReports
' leaving its RowSource property blank.
' Notes: All arguments are provided to the function automatically.
Dim db As Database, dox As Documents, i As Integer
Static sRptName(255) As String ' Array to store report
names.
Static iRptCount As Integer ' Number of saved reports.
' Respond to the supplied value of "code".
Select Case code
Case acLBInitialize ' Called once when form
opens.
Set db = CurrentDb()
Set dox = db.Containers!Reports.Documents
iRptCount = dox.Count ' Remember number of
reports.
For i = 0 To iRptCount - 1
sRptName(i) = dox(i).Name ' Load report names into
array.
Next
EnumReports = True
Case acLBOpen
EnumReports = Timer ' Return a unique
identifier.
Case acLBGetRowCount ' Number of rows
EnumReports = iRptCount
Case acLBGetColumnCount ' 1 column
EnumReports = 1
Case acLBGetColumnWidth ' 2 inches
EnumReports = 2 * 1440
Case acLBGetValue ' The report name from the
array.
EnumReports = sRptName(row)
Case acLBEnd
Erase sRptName ' Deallocate array.
iRptCount = 0
End Select
End Function

thanks for any help

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.