|
-
Sep 24th, 2001, 05:02 AM
#1
Thread Starter
New Member
Crystal Report in VB
Hi,
I want to know how to print a crystal report file from vb - using vb code. I get no errors but not getting print or preview.
The code I use.
crystalreport1.ReportFileName = GenPath & "order.rpt"
crystalreport1.SQLQuery = strSql
crystalreport1.Destination = crptToWindow
crystalreport1.PrintReport
Can anyone help to find the bug here.
Thanks in advance
-
Sep 24th, 2001, 06:21 AM
#2
Add:
CrystalReport1.Action = 1
-
Sep 24th, 2001, 01:15 PM
#3
Thread Starter
New Member
Thanks Hack,
When I used CrystalReport1.Action = 1, I get the error msg as
Unable to connect; incorrect log on parameters
for some reason. Do you know why this error comes up? I connected the db, it did not referring to db connection.
Thanks again
-
Sep 24th, 2001, 01:59 PM
#4
Frenzied Member
Re: Crystal Report in VB
You can built connection with Report designer on the same time when You modified report.
On VB code You are giving just Reportilename and some othert options.
VB Code:
subEmptyCrystal
With frmLogo.CrystalReport1
If sSQL <> "" Then .SelectionFormula = sSQL
.WindowTitle = "MyReport"
.Formulas(0) = "Money=' " & strMoney & "'"
.DataFiles(0) = App.Path & "\MyDatabase1.Mdb"
.DataFiles(1) = = App.Path & "\MyDatabase2.Mdb"
.DataFiles(2) = = App.Path & "\MyDatabase3.Mdb"
.ReportFileName = App.Path & "\MyRaport.rpt"
.Action = 1
End With
Allways empty Crystalreport variables befor You giving Newones
Like calling sub ..
Public Sub subEmptyCrystal()
Dim i As Integer
With CrystalReport1
For i = 0 To 100
.SortFields(i) = ""
.Formulas(i) = ""
Next
.PrinterCopies = 1
.Destination = 1
.SelectionFormula = ""
.WindowTitle = ""
.ReportTitle = ""
For i = 0 To 100
.DataFiles(i) = ""
Next
End With
End sub
Last edited by oh1mie; Apr 20th, 2002 at 10:24 AM.
oh1mie/Vic

-
Sep 24th, 2001, 02:27 PM
#5
Thanks oh1mie. I actually had to do some work today, so I didn't get the chance to get back to the forum until now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|