Results 1 to 4 of 4

Thread: ORDER BY problem

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    ORDER BY problem

    I am wanting to populate a ListView using the ORDER BY. I am wanting to ORDER BY on the EntryDate column which happens to be a date. It seems to work; however, its not working the way it should. Screen shots attached.

    This is what I am using:
    VB Code:
    1. Public Sub PopulateListViewSQL()
    2.     strSQL = "SELECT * "
    3.     strSQL = strSQL & "FROM Ledger "
    4.     strSQL = strSQL & "WHERE AccountNumber = '" & _
    5.     frmLedger.cboAccountNumber.Text & "' "
    6.     strSQL = strSQL & "ORDER BY EntryDate DESC"
    7.    
    8.     objCon.Execute strSQL
    9.        
    10.     PopulateListviewEntries
    11. End Sub
    12.  
    13. Public Sub PopulateListviewEntries()
    14.     OpenRecordset
    15.    
    16.     frmLedger.lvwAccountLedger.ListItems.Clear
    17.    
    18.     Do Until objRs.EOF = True
    19.    
    20.     With objRs
    21.         dteEntryDate = .Fields("EntryDate")
    22.         strTransDesc = .Fields("TransDesc")
    23.         curCredit = .Fields("Credit")
    24.         curDebit = .Fields("Debit")
    25.         intID = .Fields("id")
    26.     End With
    27.    
    28.     Set LvwItm = frmLedger.lvwAccountLedger.ListItems.Add(, , dteEntryDate)
    29.    
    30.     With LvwItm
    31.         .SubItems(1) = strTransDesc
    32.         .SubItems(2) = Format(curCredit, "0.00")
    33.         .SubItems(3) = Format(curDebit, "0.00")
    34.         .SubItems(4) = intID
    35.     End With
    36.    
    37.     objRs.MoveNext
    38.     Loop
    39. End Sub
    Attached Images Attached Images   

Posting Permissions

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



Click Here to Expand Forum to Full Width