Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,155 of 10,840    |
|    James L Hill to All    |
|    Re: Sorting help please    |
|    21 Jan 05 03:53:46    |
   
   From: james.hill83@verizon.net   
      
   I would approach this problem with a two fold solution. First convert the   
   months to numeric for ease of sorting. I would use a Case Statment for that.   
   Then store the data in a database which you can then retrieve in any order   
   you like.   
      
   Dim dblIndex As Double   
   Dim strMonth As String   
   Dim intYear As Integer   
   Dim intMonth As Integer   
   Dim filename As String   
      
      
   Open filename For Input As #1   
   Input #1, dblIndex, strMonth, intYear   
      
   'Convert Month to numeric   
   Select Case strMonth   
   Case "Jan", "January", UCase("January")   
    intMonth = 1   
      
   Case "Feb", "Febuary", UCase("Febuary")   
    intMonth = 2   
      
   Case "Mar", "March", UCase("March")   
    intMonth = 3   
      
   Case "Apr", "April", UCase("April")   
    intMonth = 4   
   ...   
   End Select   
      
   Add record to database:   
   Dim RS As Recordset   
   ...   
   RS.Fields("Index") = dblIndex   
   RS.Fields("Month") = intMonth   
   RS.Fields("Year") = intYear   
   RS.Update   
      
   Retrieve record in asc order:   
   RS.open "Select * From database Order By Year,Month,Index", conn,   
   adOpenDynamic   
      
      
      
   "Terry"
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca