VB E CRYSTAL
Olá !
Alguém sabe me dizer o que devo fazer para a que minha chamada de um relatório feito em Crystal Reports 8.0 de dentro do VB traga os dados atualizados do BD ??
No meu relatório, la menu File quando eu deixo marcada a opção : Save Data With Report eu consigo abrir o relatório no VB porém não traz os dados atuais da base de dados. Se eu desmarco essa opção, ocorre um erro quando tento abrir o relatório.
o código associado ao evento click pra chamar o relatório é o seguinte?
Crpt.ReportFileName = "C:
ome_do_relatorio.rpt"
Crpt.Action = 1
Crpt é o objeto CrystalReport
obrigado a todos pela atenção
Alguém sabe me dizer o que devo fazer para a que minha chamada de um relatório feito em Crystal Reports 8.0 de dentro do VB traga os dados atualizados do BD ??
No meu relatório, la menu File quando eu deixo marcada a opção : Save Data With Report eu consigo abrir o relatório no VB porém não traz os dados atuais da base de dados. Se eu desmarco essa opção, ocorre um erro quando tento abrir o relatório.
o código associado ao evento click pra chamar o relatório é o seguinte?
Crpt.ReportFileName = "C:
ome_do_relatorio.rpt"
Crpt.Action = 1
Crpt é o objeto CrystalReport
obrigado a todos pela atenção
Crpt.DiscardSavedData=true ->este comando descartara os dados contidos no relatorio.
Crpt.DataFiles(0)= caminho\bd
cprt.action=1
Crpt.DataFiles(0)= caminho\bd
cprt.action=1
obrigado ! mas não deu certo.
Devo informar também que o meu banco de dados está em Access 2000 e eu uso senha para acessa-lo.
abs
Ednildo
Devo informar também que o meu banco de dados está em Access 2000 e eu uso senha para acessa-lo.
abs
Ednildo
help me ..................
No arquivo RPT, vc definiu a opção Set Location como "Same as Report" ???
Na opção Set Location eu só defino a minha origem dos dados.... não tenho como "Same as Report"
a versão do crystal é a 8.0 ...
a versão do crystal é a 8.0 ...
Não uso o crystal
mas quando preciso uso o objeto Printer acho melhor:
se ajudar tenho um exermplo que uso em um dos meus programas
e é muito bom
Private Sub Command1_Click()
cmlprint.ShowPrinter
Dim db As Database
Dim rt As Recordset
Dim total As Double
Dim dtini As Date
Dim dtfim As Date
Dim linha As Double
Dim SQL As String
If MsgBox("Iniciando Impressão", vbYesNo, = vbNo Then
Exit Sub
End If
Command1.Visible = False
linha = 1
Set db = OpenDatabase(App.Path & "\controle.mdb")
SQL = "SELECT * From [tabbanco] WHERE (((tabbanco.vencimento) Is Not Null And (tabbanco.vencimento) Between #" & dtini & "# And #" & dtfim & "#)) order by (vencimento);"
Set rt = db.OpenRecordset(SQL, dbOpenDynaset, dbReadOnly)
Printer.Print
Printer.Print Tab(50); "CONTROLE DE EMISSÃO DE CHEQUES"
Printer.Print
Printer.Print
cabeçalhoum
total = 0
Do While Not rt.EOF
Printer.CurrentX = 135
Printer.Print Tab(1);
Printer.Print String(1, "|");
Printer.Print Tab(3); rt("destinatario");
Printer.Print Tab(53);
Printer.Print String(1, "|");
Printer.Print Tab(55); rt("banco");
Printer.Print Tab(78);
Printer.Print String(1, "|");
Printer.Print Tab(80); rt("conta");
Printer.Print Tab(97);
Printer.Print String(1, "|");
Printer.Print Tab(99); rt("vencimento");
Printer.Print Tab(118);
Printer.Print String(1, "|");
Printer.Print Tab(120); rt("valor");
Printer.Print Tab(133);
Printer.Print String(1, "|")
total = total + rt.Fields("valor")
linha = linha + 1
rt.MoveNext
'If linha = 1 Then
'
' Printer.Print
' Printer.Print Tab(50); "CONTROLE DE EMISSÃO DE CHEQUES"
' Printer.Print
' Printer.Print
' cabeçalhoum
'End If
Loop
Printer.Print String(181, "-")
Printer.Print
Printer.Print Tab(99); ("SOMA TOTAL");
Printer.Print Tab(115);
Printer.Print String(1, "|");
Printer.Print Tab(117); Format((total), "CURRENCY");
Printer.Print Tab(133);
Printer.Print String(1, "|")
Printer.EndDoc
rt.Close
db.Close
End Sub
Private Function cabeçalhoum()
Printer.Print String(181, "-")
Printer.Print Tab(1);
Printer.Print String(1, "|");
Printer.Print Tab(3); "DESTINATÃ ÂRIO";
Printer.Print Tab(53);
Printer.Print String(1, "|");
Printer.Print Tab(55); "BANCO";
Printer.Print Tab(78);
Printer.Print String(1, "|");
Printer.Print Tab(80); "CONTA";
Printer.Print Tab(97);
Printer.Print String(1, "|");
Printer.Print Tab(99); "VENCIMENTO";
Printer.Print Tab(118);
Printer.Print String(1, "|");
Printer.Print Tab(120); "VALOR";
Printer.Print Tab(133);
Printer.Print String(1, "|")
Printer.Print String(181, "-")
End Function
mas quando preciso uso o objeto Printer acho melhor:
se ajudar tenho um exermplo que uso em um dos meus programas
e é muito bom
Private Sub Command1_Click()
cmlprint.ShowPrinter
Dim db As Database
Dim rt As Recordset
Dim total As Double
Dim dtini As Date
Dim dtfim As Date
Dim linha As Double
Dim SQL As String
If MsgBox("Iniciando Impressão", vbYesNo, = vbNo Then
Exit Sub
End If
Command1.Visible = False
linha = 1
Set db = OpenDatabase(App.Path & "\controle.mdb")
SQL = "SELECT * From [tabbanco] WHERE (((tabbanco.vencimento) Is Not Null And (tabbanco.vencimento) Between #" & dtini & "# And #" & dtfim & "#)) order by (vencimento);"
Set rt = db.OpenRecordset(SQL, dbOpenDynaset, dbReadOnly)
Printer.Print
Printer.Print Tab(50); "CONTROLE DE EMISSÃO DE CHEQUES"
Printer.Print
Printer.Print
cabeçalhoum
total = 0
Do While Not rt.EOF
Printer.CurrentX = 135
Printer.Print Tab(1);
Printer.Print String(1, "|");
Printer.Print Tab(3); rt("destinatario");
Printer.Print Tab(53);
Printer.Print String(1, "|");
Printer.Print Tab(55); rt("banco");
Printer.Print Tab(78);
Printer.Print String(1, "|");
Printer.Print Tab(80); rt("conta");
Printer.Print Tab(97);
Printer.Print String(1, "|");
Printer.Print Tab(99); rt("vencimento");
Printer.Print Tab(118);
Printer.Print String(1, "|");
Printer.Print Tab(120); rt("valor");
Printer.Print Tab(133);
Printer.Print String(1, "|")
total = total + rt.Fields("valor")
linha = linha + 1
rt.MoveNext
'If linha = 1 Then
'
' Printer.Print
' Printer.Print Tab(50); "CONTROLE DE EMISSÃO DE CHEQUES"
' Printer.Print
' Printer.Print
' cabeçalhoum
'End If
Loop
Printer.Print String(181, "-")
Printer.Print
Printer.Print Tab(99); ("SOMA TOTAL");
Printer.Print Tab(115);
Printer.Print String(1, "|");
Printer.Print Tab(117); Format((total), "CURRENCY");
Printer.Print Tab(133);
Printer.Print String(1, "|")
Printer.EndDoc
rt.Close
db.Close
End Sub
Private Function cabeçalhoum()
Printer.Print String(181, "-")
Printer.Print Tab(1);
Printer.Print String(1, "|");
Printer.Print Tab(3); "DESTINATÃ ÂRIO";
Printer.Print Tab(53);
Printer.Print String(1, "|");
Printer.Print Tab(55); "BANCO";
Printer.Print Tab(78);
Printer.Print String(1, "|");
Printer.Print Tab(80); "CONTA";
Printer.Print Tab(97);
Printer.Print String(1, "|");
Printer.Print Tab(99); "VENCIMENTO";
Printer.Print Tab(118);
Printer.Print String(1, "|");
Printer.Print Tab(120); "VALOR";
Printer.Print Tab(133);
Printer.Print String(1, "|")
Printer.Print String(181, "-")
End Function
Obrigado, mas eu preciso realmente resolver o problema no crystal
Tópico encerrado , respostas não são mais permitidas