VB E CRYSTAL

USUARIO.EXCLUIDOS 22/03/2005 13:23:46
#74283
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

USUARIO.EXCLUIDOS 22/03/2005 13:36:01
#74287
Crpt.DiscardSavedData=true ->este comando descartara os dados contidos no relatorio.
Crpt.DataFiles(0)= caminho\bd
cprt.action=1
USUARIO.EXCLUIDOS 23/03/2005 09:38:55
#74430
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
USUARIO.EXCLUIDOS 24/03/2005 12:38:36
#74675
help me ..................
LGUSTAVOC 24/03/2005 13:16:31
#74679
No arquivo RPT, vc definiu a opção Set Location como "Same as Report" ???
USUARIO.EXCLUIDOS 25/03/2005 11:14:41
#74873
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 ...

USUARIO.EXCLUIDOS 27/03/2005 12:58:30
#75170
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
USUARIO.EXCLUIDOS 28/03/2005 10:09:29
#75282
Obrigado, mas eu preciso realmente resolver o problema no crystal
Tópico encerrado , respostas não são mais permitidas