JPaulo
Ai vai o código:
Private Sub CommandButton35_Click()
'pesquisa por valor
Dim cx As New ClasseConexao
Dim banco As ADODB.Recordset
Dim sql As String
Me.ListView3.ColumnHeaders.Clear
Me.ListView3.ListItems.Clear
sql = "SELECT * FROM movimento"
sql = sql & " WHERE valor = '" & Me.TextBox25.Value & "'ORDER BY data, nome, codigo ASC;"
Set banco = New ADODB.Recordset
cx.Conectar
'Executar a SQL
On Error Resume Next
banco.Open sql, cx.Conn, adOpenKeyset
Me.ListView3.Gridlines = True
Me.ListView3.View = lvwReport
Me.ListView3.ColumnHeaders.Add , , "Código"
Me.ListView3.ColumnHeaders.Add , , "Descrição"
Me.ListView3.ColumnHeaders.Add , , "Data"
Me.ListView3.ColumnHeaders.Add , , "Valor"
Me.ListView3.ColumnHeaders.Add , , "Conta"
Me.ListView3.ColumnHeaders.Add , , "Cheque"
Me.ListView3.ColumnHeaders.Add , , "Tipo"
Me.ListView3.ColumnHeaders.Add , , "Pago"
Me.ListView3.ColumnHeaders.Add , , "Cópia de Chq. Nº"
Me.ListView3.ColumnHeaders.Add , , "Dia da Semana"
Me.ListView3.ColumnHeaders(1).Width = 40 'Código
Me.ListView3.ColumnHeaders(2).Width = 200 'Descrição
Me.ListView3.ColumnHeaders(3).Width = 60 'Data
Me.ListView3.ColumnHeaders(3).Alignment = lvwColumnCenter
Me.ListView3.ColumnHeaders(4).Width = 100 'Valor
Me.ListView3.ColumnHeaders(4).Alignment = lvwColumnRight
Me.ListView3.ColumnHeaders(5).Width = 50 'Conta
Me.ListView3.ColumnHeaders(5).Alignment = lvwColumnCenter
Me.ListView3.ColumnHeaders(6).Width = 65 'Cheque Nº
Me.ListView3.ColumnHeaders(6).Alignment = lvwColumnCenter
Me.ListView3.ColumnHeaders(7).Width = 30 'Tipo
Me.ListView3.ColumnHeaders(7).Alignment = lvwColumnCenter
Me.ListView3.ColumnHeaders(
.Width = 60 'Pago
Me.ListView3.ColumnHeaders(
.Alignment = lvwColumnCenter
Me.ListView3.ColumnHeaders(9).Width = 80 'Cópia de Chq. Nº
Me.ListView3.ColumnHeaders(9).Alignment = lvwColumnCenter
Me.ListView3.ColumnHeaders(10).Width = 80 'Semana
Me.ListView3.ColumnHeaders(10).Alignment = lvwColumnCenter
Me.ListView3.FullRowSelect = True
Dim I, N, Z
Dim j
N = 0
Z = 0
For I = 0 To banco.RecordCount - 1
Set j = Me.ListView3.ListItems.Add(, , banco(0))
If Not IsNull(banco(0)) Then
j.SubItems(1) = banco(1)
j.SubItems(2) = banco(2)
j.SubItems(3) = banco(3)
j.SubItems(3) = Format(j.SubItems(3), """R$ ""* #,##0.00;""R$ ""* (#,##0.00);""R$ ""* ""-"";_(@_)")
N = banco(3)
Z = N + Z
j.SubItems(4) = banco(4)
j.SubItems(5) = banco(5)
j.SubItems(6) = banco(6)
j.SubItems(7) = banco(7)
j.SubItems(
= banco(
j.SubItems(9) = banco(9) 'Semana
j.SubItems(9) = Format(j.SubItems(9), "dddd")
End If
banco.MoveNext
Next I
Set banco = Nothing
cx.Desconectar
Label74 = Format(Z, """R$ ""* #,##0.00;""R$ ""* (#,##0.00);""R$ ""* ""-""")
End Sub