what i'm trying to do is something like this:
i have a filter form in witch the user chooses the client number (<, =, >) or the clients car license plate (<, =, >)
depending on witch search the user chooses (client number, license plate) an SQL statement is generated only showing the filtered files on the CR.
the SQL statement that allows the viewing of the data is the following:
SELECT
Veiculo.veic_matricula, Veiculo.veic_nquadro,
Modelo.model_nome,
Marca.marca_nome,
Versao.versao_nome,
CLMES.NOME
FROM
TESTES.dbo.Veiculo Veiculo,
TESTES.dbo.Modelo Modelo,
TESTES.dbo.Marca Marca,
TESTES.dbo.Versao Versao,
TESTES.dbo.CLMES CLMES
WHERE
Veiculo.veic_modeloID = Modelo.model_id AND
Veiculo.veic_marcaID = Marca.marca_id AND
Veiculo.veic_versaoID = Versao.versao_id AND
Veiculo.veic_proprietarioID = CLMES.CLIENTE
the code that i'm using is:
Private Sub cmdVeicBusca_Click(Index As Integer)
Select Case cmdVeicBusca(Index).Value = True
Case Index = 0:
strSQLveic = "SELECT " & _
"Veiculo.veic_matricula, Veiculo.veic_nquadro, Modelo.model_nome, Marca.marca_nome," & _
"Versao.versao_nome, CLMES.NOME " & _
"From " & _
"TESTES.dbo.Veiculo Veiculo, TESTES.dbo.Modelo Modelo, TESTES.dbo.Marca Marca, " & _
"TESTES.dbo.Versao Versao, TESTES.dbo.CLMES CLMES " & _
"Where " & _
"Veiculo.veic_modeloID = Modelo.model_id AND Veiculo.veic_marcaID = Marca.marca_id AND " & _
"Veiculo.veic_versaoID = Versao.versao_id AND Veiculo.veic_proprietarioID = CLMES.CLIENTE"
strCLTveic = ""
If Len(Trim(nbxVeicLmtInf(0).Text)) > 0 Then
If optVeicClienteLI(0).Value = True Then
Operador = ">"
ElseIf optVeicClienteLI(1).Value = True Then
Operador = "="
Else
Operador = "<"
End If
strCLTveic = " and veic_proprietarioID" & Operador & nbxVeicLmtInf(0).Text
End If
strSQLveic = strSQLveic + strCLTveic
crVeiculo.SQLQueryString = strSQLveic
AbrirReportVeiculo
End Select
End Sub
Sub AbrirReportVeiculo()
ReportVeiculo.Database.LogOnServer "p2ssql.dll", "Sql2000", "TESTES", "agenda", "testes"
frmCRViewer.CRViewer1.ReportSource = ReportVeiculo
frmCRViewer.CRViewer1.ViewReport
frmCRViewer.Caption = "Veiculo Report"
BotoesImpressao
frmCRViewer.cmdVeicPrint.Visible = True
frmCRViewer.Show vbModal
End Sub
the statement hasn't started working yet.
can anyone tell me how to pass the SQL statment to the CR??
It's extremely URGENT !!
Thank 'u all...