Results 1 to 11 of 11
  1. #1
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601

    Question Unanswered: List all the reports

    A while back somebody asked about just listing all the reports in a list/combo box for the user. We all were like why do you need that, I think. Well, I have found a reason, and I need it also. I finally got to talk to my boss about our database, She gave me a list of 6 reports that she'll regularly need with more to come. I think that's a tad too much to slap on a switchboard individually. Can somebody give a hint or the VBA code. Thanks
    Ryan
    My Blog

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    That's not hard to do, but you may want to consider adding a "reports module" with a little schema behind it.

    Anyways:
    Code:
        Dim obj As AccessObject, dbs As Object
        Set dbs = Application.CurrentProject
        For Each obj In dbs.AllReports
                yourListBox.AddItem obj.name
        Next obj
    Last edited by Teddy; 07-20-04 at 14:07.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Thanks man. Do I make this mod as the RecordSource?
    Ryan
    My Blog

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Post

    You can do it using SQL
    PHP Code:
    SELECT MSysObjects.Name
      FROM MSysObjects
        WHERE 
    (((MSysObjects.Type)=-32764))
           
    ORDER BY MSysObjects.Name

  5. #5
    Join Date
    Apr 2003
    Location
    Alabama, USA
    Posts
    154
    I have a sample database here that shows how to do the following with reports
    • Preview
    • Print
    • Save (Snapshot)
    • Email
    • Change Description & Caption
    It isn't perfect, though (see that thread for more details). I know some of the problems and things that I'd like to change but I haven't had time to go back in and fix it.
    http://AccessDB.Info

    You live and learn. At any rate, you live. - Douglas Adams

  6. #6
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Quote Originally Posted by hammbakka
    You can do it using SQL
    PHP Code:
    SELECT MSysObjects.Name
    FROM MSysObjects
    WHERE 
    (((MSysObjects.Type)=-32764))
    ORDER BY MSysObjects.Name
    I assume you mean plop that into a query, and use that as the source for a combo.

    Quote Originally Posted by Cosmos75
    I have a sample database here that shows how to do the following with reports
    • Preview
    • Print
    • Save (Snapshot)
    • Email
    • Change Description & Caption
    It isn't perfect, though (see that thread for more details). I know some of the problems and things that I'd like to change but I haven't had time to go back in and fix it.
    Cosmos-- I know how to do that, I need to call them, as objects
    Last edited by rguy84; 07-20-04 at 12:08.
    Ryan
    My Blog

  7. #7
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    I cannot get that SQL to work

    Nevermind. I got it BUT I want it to be in a drop down box, but when the box drops its empty?
    Last edited by rguy84; 07-20-04 at 13:24.
    Ryan
    My Blog

  8. #8
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Place this in the FormLoad event of a list box:

    Code:
      Private Sub Form_Load()
    
        Dim objAO As AccessObject
        Dim objCP As Object
        Dim strValues As String
        
        Set objCP = Application.CurrentProject
        
        For Each objAO In objCP.AllReports
            strValues = strValues & objAO.Name & ";"
        Next objAO
        
        FirstReports.RowSourceType = "Value List"
        FirstReports.RowSource = strValues
    
    End Sub
    Bud

  9. #9
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Thanks Bud! But I got it going a while ago. I couldn't find that event pertaining to a listbox...but I found it in the general form. So i just pasted that in the VB editor and got a 424 runtime error
    Ryan
    My Blog

  10. #10
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    glad you got it, just trying to lend a hand. Wow so many contributors...wonderful!!!!

    Bud

  11. #11
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601

    Thumbs up

    Quote Originally Posted by Bud
    glad you got it, just trying to lend a hand. Wow so many contributors...wonderful!!!!

    Bud
    Yup, very awesome, this should be one of the top forums
    Ryan
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •