|
-
Oct 2nd, 2002, 03:46 PM
#1
Thread Starter
Hyperactive Member
please look at the code
Can some one please look at the code and tell me whats wrong with it .. I have been doing this thing for a long time .. everything in the code works but when it gets to the last line where i am trying to print the report out it gives me an error that the print routine failed .. but it still prints all the reports ..
Dim Report As New CrystalReport1
Private Sub Form_Load()
Dim TransDate As Date
Dim tempDay As String
tempDay = Format(Date, "dddd")
If tempDay = "Monday" Then
TransDate = Format(Date - 5, "m/d/yyyy")
Else
TransDate = Format(Date - 3, "m/d/yyyy")
End If
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
Report.EnableParameterPrompting = False
Report.ReadRecords
Set params = Report.ParameterFields
For Each param In params
With param
.ClearCurrentValueAndRange
If .Name = "{?InsertDate}" Then
.AddCurrentValue TransDate
End If
End With
Next
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
Report.PrintOut False
End Sub
-
Oct 2nd, 2002, 03:48 PM
#2
Frenzied Member
Could you please edit your message so we could see code more clear. Just put CODE in square brackets [] before your code starts and /CODE after its ends.
-
Oct 2nd, 2002, 03:50 PM
#3
Thread Starter
Hyperactive Member
here you go
code im Report As New CrystalReport1
Private Sub Form_Load()
Dim TransDate As Date
Dim tempDay As String
tempDay = Format(Date, "dddd")
If tempDay = "Monday" Then
TransDate = Format(Date - 5, "m/d/yyyy")
Else
TransDate = Format(Date - 3, "m/d/yyyy")
End If
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
Report.EnableParameterPrompting = False
Report.ReadRecords
Set params = Report.ParameterFields
For Each param In params
With param
.ClearCurrentValueAndRange
If .Name = "{?InsertDate}" Then
.AddCurrentValue TransDate
End If
End With
Next
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
Report.PrintOut False
End Sub
-
Oct 2nd, 2002, 03:50 PM
#4
Need-a-life Member
Re: please look at the code
He meant that you should do put these tags: [vbcode][/vbcode] to make it more readable. Liek this:
VB Code:
Dim Report As New CrystalReport1
Private Sub Form_Load()
Dim TransDate As Date
Dim tempDay As String
tempDay = Format(Date, "dddd")
If tempDay = "Monday" Then
TransDate = Format(Date - 5, "m/d/yyyy")
Else
TransDate = Format(Date - 3, "m/d/yyyy")
End If
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
Report.EnableParameterPrompting = False
Report.ReadRecords
Set params = Report.ParameterFields
For Each param In params
With param
.ClearCurrentValueAndRange
If .Name = "{?InsertDate}" Then
.AddCurrentValue TransDate
End If
End With
Next
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
Report.PrintOut False
End Sub
Besides, post a better subject. "Please look at the code" means nothing to me.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 2nd, 2002, 03:51 PM
#5
Thread Starter
Hyperactive Member
Code:
Dim Report As New CrystalReport1
Private Sub Form_Load()
Dim TransDate As Date
Dim tempDay As String
tempDay = Format(Date, "dddd")
If tempDay = "Monday" Then
TransDate = Format(Date - 5, "m/d/yyyy")
Else
TransDate = Format(Date - 3, "m/d/yyyy")
End If
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
Report.EnableParameterPrompting = False
Report.ReadRecords
Set params = Report.ParameterFields
For Each param In params
With param
.ClearCurrentValueAndRange
If .Name = "{?InsertDate}" Then
.AddCurrentValue TransDate
End If
End With
Next
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
Report.PrintOut False
End Sub
-
Oct 2nd, 2002, 03:52 PM
#6
Thread Starter
Hyperactive Member
Thanx,
But can you guys see now why is it giving me this error
-
Oct 2nd, 2002, 03:52 PM
#7
-
Oct 2nd, 2002, 03:53 PM
#8
Lively Member
Try putting vbCode in braces (ex:[]) at the beginngin of the code and /vbCode in braces at the end of the code.
Instead of this:
If bla then 'My Code
Or this with code tags:
Code:
If bla then 'MyCode
Your code will look like this:
Try that.
ERROR: No keyboard detected. Hit F1 to continue.
-
Oct 2nd, 2002, 03:53 PM
#9
Frenzied Member
Ye that... Thanks Mc Brain
-
Oct 2nd, 2002, 03:53 PM
#10
Need-a-life Member
Originally posted by fasi
Thanx,
But can you guys see now why is it giving me this error
Sorry... I've only worked with Crystal Reports a few times and don't remember anything. That's why a proper subject is important!!!
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 2nd, 2002, 03:56 PM
#11
Frenzied Member
On what line are you getting an error?
-
Oct 2nd, 2002, 03:57 PM
#12
Thread Starter
Hyperactive Member
the last line where
report.printout false
-
Oct 2nd, 2002, 03:57 PM
#13
Here's an importaint question: What's the error? <snip> -- ignore this part -- And specify EXACTLY what line it is giving an error on....</snip>
-
Oct 2nd, 2002, 04:05 PM
#14
Frenzied Member
If you using Crystal Report Control, there is no such thing as .PrintOut
try
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
|