-
I have created a simple report using Crystal Report 32 that come with my vb6.
I then add a crystal report component and a command button into my form. In my command button click event i put in this code:
private sub command1_click()
crystalreport1.ReportFileName = app.path "\test.rpt"
crystalreport1.DiscardSaveData = True
crystalreport1.PrintReport
end sub
when I click on the command1 button nothing appear! I have a printer configured for the crystall report.
there is also no report of error during compilation or executing this code.
Where is my error????
-
My program is working now. don't know why maybe my careless typo error.
anyway thanks for your help
regards
-
Do you believe the same commands work on my laptop and desktop using win98 os but it refuse to work on my NT station???
Regards
-
Crystal doesn't always display errors when it fails - try this;
Code:
Private Sub Command1_Click()
Dim RepResult as Integer
With CrystalReport1
.ReportFileName=App.Path+"\Test.RPT"
.DiscardSavedData=True
RepResult = .PrintReport
If RepResult <> 0 Then
MsgBox "CRYSTAL ERROR: (" + CStr(.LastErrorNumber) + ") " + .LastErrorString, vbExclamation, "Can't Continue"
End If
End With
End Sub
That way, if there is an error you will get a message about it - do you?
-
Quote:
Originally posted by Buzby
Crystal doesn't always display errors when it fails - try this;
Code:
Private Sub Command1_Click()
Dim RepResult as Integer
With CrystalReport1
.ReportFileName=App.Path+"\Test.RPT"
.DiscardSavedData=True
RepResult = .PrintReport
If RepResult <> 0 Then
MsgBox "CRYSTAL ERROR: (" + CStr(.LastErrorNumber) + ") " + .LastErrorString, vbExclamation, "Can't Continue"
End If
End With
End Sub
That way, if there is an error you will get a message about it - do you?