Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002

    Unanswered: How do you sort an array?

    Access help says that you may need to sort if you use code like below.
    The ListMDBs function is for a combo box and entered into the Row Source Type. Works great but not sorted. How do you sort an array???

    Function ListMDBs(fld As Control, id As Variant, row As Variant, col As Variant, code As Variant) As Variant
    Static dbs(127) As String, Entries As Integer
    Dim ReturnVal As Variant
    ReturnVal = Null
    Select Case code
    Case acLBInitialize ' Initialize.
    Entries = 0
    ChDir "\banctec\partsMDB" 'on current drive
    dbs(Entries) = Dir("xfer*.MDB")
    Do Until dbs(Entries) = "" Or Entries >= 127
    Entries = Entries + 1
    dbs(Entries) = Dir
    ReturnVal = Entries

    Case acLBOpen ' Open.
    ReturnVal = Timer ' Generate unique ID for control.
    Case acLBGetRowCount ' Get number of rows.
    ReturnVal = Entries
    Case acLBGetColumnCount ' Get number of columns.
    ReturnVal = 1
    Case acLBGetColumnWidth ' Column width.
    ReturnVal = -1 ' -1 forces use of default width.
    Case acLBGetValue ' Get data.
    ReturnVal = dbs(row)

    Case acLBEnd ' End.
    Erase dbs
    End Select
    ListMDBs = ReturnVal
    End Function

  2. #2
    Join Date
    Nov 2002
    San Francisco

    Re: How do you sort an array?

    tons of articles were written on this topic..... Visual Basic is not C++ so manual work!

    check this;en-us;q169617


Posting Permissions

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