Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 28th, 2003, 01:10 PM
Registered User
Join Date: Aug 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic freport list not functioning

I have created a form call frmlistreports, which displays a list of available "global" reports. This list is dynamic, each time a user creates and saves a new report, it is added to the available list (see code below). I have been able to exclude [hide certain reports (those that begin with X_ and run from a specific screen or individual's record) to alleviate confusion, etc.

I have two problems, which have eluded me.

1) I would like to have the reports displayed in alphabetical order when the form is opened or gets the focus back. I have tried everything I can think of and nothing works.

2) I would like to expand my If statement to allow additional exclusionary criteria (i.e. a series of "Maintenance" reports [Starting with Maint_] ) would only be seen from a Maintenance form and all others would be hidden, while the Maintenance reports would not show on the main form. I am really stumped here, have tried many permeations of If Then Else, nothing works for me.

Help !!!!!


‘ Code to create dynamic report list
Private Sub Form_Load()
    Dim objao As AccessObject
    Dim objcp As Object
    Dim strValues As String
    Set objcp = Application.CurrentProject
    ListReports.RowSourceType = "Value List"

‘ Code to exclude reports starting with X_ from the dynamic report list

    For Each objao In objcp.AllReports
    If Left(objao.Name, 2) <> "X_" Then
      strValues = strValues & objao.Name & ";"
      Debug.Print objao.Name

    End If
    ListReports.RowSource = strValues
    Next objao
End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic List Content cyberddindia Classic ASP Basics 3 October 24th, 2006 10:29 AM
Dynamic Combobox List Intern06 Pro VB Databases 2 June 29th, 2006 09:41 AM
dynamic list al-hijjawi ASP.NET 1.0 and 1.1 Basics 3 April 7th, 2006 11:05 AM
Tell about dynamic list boxes shyamprasad Classic ASP Components 3 February 8th, 2005 02:38 PM
creating dynamic list fyeojo VS.NET 2002/2003 4 September 2nd, 2003 03:13 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.