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:
Public Sub PopulateListViewSQL() strSQL = "SELECT * " strSQL = strSQL & "FROM Ledger " strSQL = strSQL & "WHERE AccountNumber = '" & _ frmLedger.cboAccountNumber.Text & "' " strSQL = strSQL & "ORDER BY EntryDate DESC" objCon.Execute strSQL PopulateListviewEntries End Sub Public Sub PopulateListviewEntries() OpenRecordset frmLedger.lvwAccountLedger.ListItems.Clear Do Until objRs.EOF = True With objRs dteEntryDate = .Fields("EntryDate") strTransDesc = .Fields("TransDesc") curCredit = .Fields("Credit") curDebit = .Fields("Debit") intID = .Fields("id") End With Set LvwItm = frmLedger.lvwAccountLedger.ListItems.Add(, , dteEntryDate) With LvwItm .SubItems(1) = strTransDesc .SubItems(2) = Format(curCredit, "0.00") .SubItems(3) = Format(curDebit, "0.00") .SubItems(4) = intID End With objRs.MoveNext Loop End Sub




Reply With Quote