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

Calling Temporary reports in List Box of Reports

P: 78
I have created a form for listing my reports using tips and code from Allen Browne's website. The Code is as Follows:
Expand|Select|Wrap|Line Numbers
  1.  Function EnumReports(fld As Control, id As Variant, row As Variant, col As Variant, code As Variant) As Variant
  2.     ' Purpose:  Supplies the name of all saved reports to a list box.
  3.     ' Usage:    Set the list box's RowSourceType property to:? EnumReports
  4.     '               leaving its RowSource property blank.
  5.     ' Notes:    All arguments are provided to the function automatically.
  6.     ' Author:   Allen Browne        allen@allenbrowne.com    Feb.'97.
  7.  
  8.     Dim db As Database, dox As Documents, i As Integer
  9.     Static sRptName(255) As String              ' Array to store report names.
  10.     Static iRptCount As Integer                 ' Number of saved reports.
  11.  
  12.     ' Respond to the supplied value of "code".
  13.     Select Case code
  14.         Case acLBInitialize                     ' Called once when form opens.
  15.             Set db = CurrentDb()
  16.             Set dox = db.Containers!Reports.Documents
  17.             iRptCount = dox.Count               ' Remember number of reports.
  18.             For i = 0 To iRptCount - 1
  19.                 sRptName(i) = dox(i).Name       ' Load report names into array.
  20.             Next
  21.             EnumReports = True
  22.         Case acLBOpen
  23.             EnumReports = Timer                 ' Return a unique identifier.
  24.         Case acLBGetRowCount                    ' Number of rows
  25.             EnumReports = iRptCount
  26.         Case acLBGetColumnCount                 ' 1 column
  27.             EnumReports = 1
  28.         Case acLBGetColumnWidth                 ' 2 inches
  29.             EnumReports = 2 * 1440
  30.         Case acLBGetValue                       ' The report name from the array.
  31.             EnumReports = sRptName(row)
  32.         Case acLBEnd
  33.             Erase sRptName                      ' Deallocate array.
  34.             iRptCount = 0
  35.     End Select
  36. End Function 
How do I keep this from listing "~TMP*" repoorts?
Dec 12 '06 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,669
I have created a form for listing my reports using tips and code from Allen Browne's website. The Code is as Follows:
Expand|Select|Wrap|Line Numbers
  1.  Function EnumReports(fld As Control, id As Variant, row As Variant, col As Variant, code As Variant) As Variant
  2.     ' Purpose:  Supplies the name of all saved reports to a list box.
  3.     ' Usage:    Set the list box's RowSourceType property to:? EnumReports
  4.     '               leaving its RowSource property blank.
  5.     ' Notes:    All arguments are provided to the function automatically.
  6.     ' Author:   Allen Browne        allen@allenbrowne.com    Feb.'97.
  7.  
  8.     Dim db As Database, dox As Documents, i As Integer
  9.     Static sRptName(255) As String              ' Array to store report names.
  10.     Static iRptCount As Integer                 ' Number of saved reports.
  11.  
  12.     ' Respond to the supplied value of "code".
  13.     Select Case code
  14.         Case acLBInitialize                     ' Called once when form opens.
  15.             Set db = CurrentDb()
  16.             Set dox = db.Containers!Reports.Documents
  17.             iRptCount = dox.Count               ' Remember number of reports.
  18.             For i = 0 To iRptCount - 1
  19.                 sRptName(i) = dox(i).Name       ' Load report names into array.
  20.             Next
  21.             EnumReports = True
  22.         Case acLBOpen
  23.             EnumReports = Timer                 ' Return a unique identifier.
  24.         Case acLBGetRowCount                    ' Number of rows
  25.             EnumReports = iRptCount
  26.         Case acLBGetColumnCount                 ' 1 column
  27.             EnumReports = 1
  28.         Case acLBGetColumnWidth                 ' 2 inches
  29.             EnumReports = 2 * 1440
  30.         Case acLBGetValue                       ' The report name from the array.
  31.             EnumReports = sRptName(row)
  32.         Case acLBEnd
  33.             Erase sRptName                      ' Deallocate array.
  34.             iRptCount = 0
  35.     End Select
  36. End Function 
How do I keep this from listing "~TMP*" repoorts?
'I've returned a sub-set of your code with changes indicated by a *. It was
'tested on my PC and works fine. Hope this helps you...

Expand|Select|Wrap|Line Numbers
  1. * Dim T As Integer                            'New Array Index to prevent "Holes"
  2.  
  3.     ' Respond to the supplied value of "code".
  4.     Select Case code
  5.         Case acLBInitialize                     ' Called once when form opens.
  6.             Set db = CurrentDb()
  7.             Set dox = db.Containers!Reports.Documents
  8.             iRptCount = dox.Count               ' Remember number of reports.
  9.             For i = 0 To iRptCount - 1
  10.               * If Left(dox(i).Name, 1) <> "~" Then
  11.                    * sRptName(T) = dox(i).Name       ' Load report names into array.
  12.                    * T = T + 1
  13.               * End If
  14.             Next
  15.             EnumReports = True
Dec 12 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.