Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 4th, 2005, 02:17 PM
LinuxGold LinuxGold is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 45 LinuxGold User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 18 m 4 sec
Reputation Power: 4
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

Reply With Quote
  #2  
Old October 5th, 2005, 12:02 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
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

Reply With Quote
  #3  
Old October 5th, 2005, 07:20 AM
LinuxGold LinuxGold is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 45 LinuxGold User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 18 m 4 sec
Reputation Power: 4
Quote:
Originally Posted by Doug G
Why not just use an ORDER BY in the SQL that opens your recordset?


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.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > SortOrder


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT