Pessoal,
Mais uma vez, estou aqui precisando de uma ajuda de vcs.
Estou com uma consulta com dois parametros e quero colocar mais um parâmetros,mais não estou conseguindo. Vcs podem me ajudar.
Segue a rotina que estou usando.
Private Sub AtualizaGrid()
Dim Parametros As String
Parametros = CboBandeira
Categorias = CboCat
If Parametros = "( Selecione...)" Then
Parametros = ""
End If
If DtpInicio > DtpFim Then
MsgBox "Data Início não pode ser maior Data Fim", vbExclamation, "Pesquisa Oferta"
Else
pr = ""
If Trim(Parametros) <> "" Then
pr = " And Folhetos.DescBand = '" & Parametros & "'"
End If
Cat = ""
If Trim(Categorias) <> "" Then
pr = " And Folhetos.Categorias = '" & Categorias & "'"
End If
Set Rs = Banco.OpenRecordset("SELECT * FROM Folhetos Where DtCamp BETWEEN #" & Format(DtpInicio.Value, "YYYY/MM/DD") & "# AND #" & Format(DtpFim.Value, "YYYY/MM/DD") & "#" & pr And cAT)
i = 1
If Rs.EOF Then
GrdPesquisa.Clear
Call FormatoGrid
MsgBox "Não existe dados para consultar", vbExclamation, "Consulta Oferta"
Else
Do While Not Rs.EOF
With GrdPesquisa
.Rows = i + 1
.TextMatrix(i, 0) = Rs![IdPLu]
.TextMatrix(i, 1) = Rs![DescPlu]
.TextMatrix(i, 2) = Rs![DescBand]
.TextMatrix(i, 3) = Rs![Notab]
.TextMatrix(i, 4) = Rs![DtCamp]
.TextMatrix(i, 5) = Rs![CustNetDc1]
.TextMatrix(i, 6) = Rs![PmzNet]
.TextMatrix(i, 7) = Rs![PrMedmerc]
.TextMatrix(i, 8) = Rs![PrOferta]
.TextMatrix(i, 9) = Rs![Compet]
.TextMatrix(i, 10) = Rs![PercMgNetDc1]
.TextMatrix(i, 11) = Rs![Dc2Unid]
.TextMatrix(i, 12) = Rs![PercMgNetNet]
.TextMatrix(i, 13) = Rs![QtdVdUnid]
.TextMatrix(i, 14) = Rs![Dc2Total]
.TextMatrix(i, 15) = Rs![VlMgNetNet]
.TextMatrix(i, 16) = Rs![VlVenda]
End With
i = i + 1
Rs.MoveNext
Loop
End If
End If
End Sub
Obrigado,