Re: alphabetical order of reports in a listbox

Discussion in 'Microsoft Access Reports' started by Duane Hookom, Sep 14, 2009.

  1. Duane Hookom

    Duane Hookom Guest

    Try:
    SELECT Mid([Name],4) As RptName
    FROM MsysObjects
    WHERE [Type] = -32764 AND Right([Name],3) IN ("rpt","rpf")
    ORDER BY Mid([Name],4);

    --
    Duane Hookom
    Microsoft Access MVP


    "imstuck via AccessMonster.com" wrote:

    > imstuck wrote:
    > >i have this code on my list box:
    > >This displays all the reports i have with "rpt" & "rpf" word at the beginning
    > >of the report name.
    > >
    > >Private Sub Form_Open(Cancel As Integer)
    > > Dim objAO As AccessObject
    > > Dim objCP As Object
    > > Dim strValues As String
    > >Set objCP = Application.CurrentProject
    > >For Each objAO In objCP.AllReports
    > > If Left(objAO.Name, 3) = "rpt" Or Left(objAO.Name, 3) = "rpf" Then
    > > strValues = strValues & Mid(objAO.Name, 4) & ";" & Left(objAO.Name, 3)
    > >& ";"
    > > End If
    > >Next objAO
    > >lstReports.RowSourceType = "Value List"
    > >lstReports.RowSource = strValues
    > >End Sub
    > >
    > >my problem is, i want to display the reports in alphabetical order. How can i
    > >do that?
    > >thanks

    >
    >
    > i also tried this:
    >
    > SELECT [Name] FROM MsysObjects
    > WHERE (([Type] = -32764) AND ([Name] Not Like "~*") AND ([Name] Not Like
    > "MSys*"))
    > ORDER BY [Name];
    >
    > --
    > Message posted via http://www.accessmonster.com
    >
    >
     
    Duane Hookom, Sep 14, 2009
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sue
    Replies:
    1
    Views:
    154
    Duane Hookom
    Mar 4, 2004
  2. Kelly

    Alphabetical Abreviations

    Kelly, May 5, 2004, in forum: Microsoft Access Reports
    Replies:
    0
    Views:
    166
    Kelly
    May 5, 2004
  3. Guest

    Do not want fields to show in alphabetical order

    Guest, Nov 23, 2004, in forum: Microsoft Access Reports
    Replies:
    11
    Views:
    270
    Rick Brandt
    Dec 16, 2004
  4. Guest
    Replies:
    1
    Views:
    153
    Al Camp
    Nov 29, 2005
  5. alison.justice

    Crosstab Row Sorting in Alphabetical Order

    alison.justice, Sep 10, 2009, in forum: Microsoft Access Reports
    Replies:
    7
    Views:
    156
    Duane Hookom
    Sep 10, 2009
Loading...

Share This Page