FILTRO_MSFLEXGRID_ACCESS

FERRAZ 12/11/2010 15:45:57
#357328
Marcelo, meus amigos, resolvido, consulta funcionando com sucesso.

Sub para preecher os campos do form [Ô]Projeto[Ô] alterada e funcionando:

Private Sub PreecheConsulta_Projeto()

Dim SQL As String
SQL = [Ô]SELECT * FROM TbProjeto WHERE ID like [ô][Ô] & TxtBsc.Text & [Ô]%[ô] order by NClt[Ô]
Set rs = cn.Execute(SQL)

With MsFlexProjeto

Do While Not rs.EOF

FrmProjeto.TxtReg.Text = .TextMatrix(.RowSel, 0)
FrmProjeto.TxtDta.Text = .TextMatrix(.RowSel, 1)
FrmProjeto.CboTipServ.Text = .TextMatrix(.RowSel, 6)
FrmProjeto.TxtClt.Text = .TextMatrix(.RowSel, 9)
FrmProjeto.TxtTlProj = .TextMatrix(.RowSel, 7)
FrmProjeto.TxtFtUso = .TextMatrix(.RowSel, 8)

FrmProjeto.ListMov.AddItem [Ô] [Ô] & (rs!Itens) & vbTab & (rs!Qtde) & vbTab & _
(rs!VUnit) & vbTab & (rs!SbTl)

rs.MoveNext

Loop

End With

End Sub


Sub de busca alterada e funcionando:

Private Sub TxtBsc_Change()
Dim SQL As String
SQL = [Ô]SELECT * FROM TbProjeto WHERE ID Like [ô][Ô] & TxtBsc.Text & [Ô]%[ô] order by NClt[Ô]
Set rs = cn.Execute(SQL)

With MsFlexProjeto
.Rows = .Rows + 1
.FixedRows = 1
.FixedCols = 0
.Rows = 1
.FormatString = [Ô]Registro |Data [Ô]

Do While Not rs.EOF

.Rows = .Rows + 1

.TextMatrix(.Rows - 1, 0) = IIf(IsNull(rs!ID), [Ô][Ô], rs!ID)
.TextMatrix(.Rows - 1, 1) = IIf(IsNull(rs!Dta), [Ô][Ô], rs!Dta)
.TextMatrix(.Rows - 1, 2) = IIf(IsNull(rs!Itens), [Ô][Ô], rs!Itens)
.TextMatrix(.Rows - 1, 3) = IIf(IsNull(rs!Qtde), [Ô][Ô], rs!Qtde)
.TextMatrix(.Rows - 1, 4) = IIf(IsNull(rs!VUnit), [Ô][Ô], rs!VUnit)
.TextMatrix(.Rows - 1, 5) = IIf(IsNull(rs!SbTl), [Ô][Ô], rs!SbTl)
.TextMatrix(.Rows - 1, 6) = IIf(IsNull(rs!TipoProjeto), [Ô][Ô], rs!TipoProjeto)
.TextMatrix(.Rows - 1, 7) = IIf(IsNull(rs!TotalProjeto), [Ô][Ô], rs!TotalProjeto)
.TextMatrix(.Rows - 1, 8) = IIf(IsNull(rs!FatorAplicado), [Ô][Ô], rs!FatorAplicado)
.TextMatrix(.Rows - 1, 9) = IIf(IsNull(rs!NClt), [Ô][Ô], rs!NClt)
.TextMatrix(.Rows - 1, 0) = Format(.TextMatrix(.Rows - 1, 0), [Ô]000000[Ô])
.TextMatrix(.Rows - 1, 4) = Format(.TextMatrix(.Rows - 1, 4), [Ô]currency[Ô])
.TextMatrix(.Rows - 1, 5) = Format(.TextMatrix(.Rows - 1, 5), [Ô]currency[Ô])
.TextMatrix(.Rows - 1, 7) = Format(.TextMatrix(.Rows - 1, 7), [Ô]currency[Ô])

rs.MoveNext

Loop
For i = 1 To .Rows - 1
If .TextMatrix(i, 1) = TxtBsc.Text Then
.TopRow = i
.RowSel = i
Exit For
End If
Next
End With

End Sub


eh sempre muito gratificante visitar e fazer parte desta comunidade sem duvida = [Ô]VbMania[Ô]. Sucesso a todos, tudo de bom.
Página 2 de 2 [11 registro(s)]
Tópico encerrado , respostas não são mais permitidas