|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SortOrder
I've been trying to figure out how to use SortOrder to sort list in InboundPath alphabetically or numerically. How do I use that function?
Code:
Option Explicit
Function DirListBox(fld As Control, ID, row, col, Code)
' Purpose: To read the contents of a directory into a ListBox.
' Usage: Create a ListBox. Set its RowSourceType to "DirListBox"
' Parameters: The arguments are provided by Access itself.
' Notes: You could read a FileSpec from an underlying form.
' Error handling not shown. More than 512 files not handled.
Dim StrFileName As String
Dim InboundPath As String
Dim dbs As Database
Dim rst As Recordset
Static StrFiles(0 To 511) As String ' Array to hold File Names
Static IntCount As Integer ' Number of Files in list
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Directory Paths")
InboundPath = rst![InboundPath]
rst.Close
Set dbs = Nothing
Select Case Code
Case 0 ' Initialize
DirListBox = True
Case 1 ' Open: load file names into array
DirListBox = Timer
IntCount = 0
' Open errtemp directory on AS/400
StrFileName = Dir$(InboundPath + "*.txt") ' Read filespec from a form here???
Do While Len(StrFileName) > 0
StrFiles(IntCount) = StrFileName
StrFileName = Dir
IntCount = IntCount + 1
Loop
Case 3 ' Rows
DirListBox = IntCount
Case 4 ' Columns
DirListBox = 1
Case 5 ' Column width in twips
DirListBox = 1440
Case 6 ' Supply data
DirListBox = StrFiles(row)
End Select
End Function
|
|
#2
|
|||
|
|||
|
Why not just use an ORDER BY in the SQL that opens your recordset?
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
Quote:
StrFileName = Dir$(InboundPath + "*.txt") This isn't a SQL statement, it is similiar to: dir /b *.txt In reality I want: dir /b /o:n *.txt Which isn't available in my program. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > SortOrder |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|