|
-
Nov 9th, 2000, 08:11 AM
#1
Thread Starter
Frenzied Member
Code:
Private Sub Form_Load()
Dim SQL As String
SQL = "{Client016.Amps } = 10"
With CP
.Reset
.DataFiles(0) = ("z:\electric meter department\meter\meter.mdb")
.ReportFileName = (App.Path & "\report1.rpt")
.WindowTitle = "Client Code Report"
.WindowState = crptMaximized
.WindowShowRefreshBtn = True
.SelectionFormula = SQL
.PrintReport
.Destination = crptToWindow
End With
End Sub
someone tell me whts wrong with my code?
and yes the report has records in it that match criteria given..
thank you
-
Nov 9th, 2000, 08:24 AM
#2
Member
put .Destination = crptToWindow before .PrintReport
-
Nov 9th, 2000, 08:26 AM
#3
Thread Starter
Frenzied Member
-
Nov 9th, 2000, 09:54 AM
#4
Thread Starter
Frenzied Member
anyone?
even this doesnt work
Code:
Dim SQL As String
SQL = "{Client016.Amps } = 200"
With CP
.DataFiles(0) = ("z:\electric meter department\meter\meter.mdb")
.ReportFileName = (App.Path & "\report1.rpt")
'.WindowTitle = "Client Code Report"
'.WindowState = crptMaximized
'.WindowShowRefreshBtn = True
'.SelectionFormula = SQL
.Destination = crptToWindow
.PrintReport
End With
it goes throu the code
but shows nothing
-
Nov 9th, 2000, 10:09 AM
#5
Frenzied Member
You don't mention which methodology your using. OCX or RTDesigner. Assuming your using the OCX, you need to use Action=1. If you designed the report with no default printer, the report will not be printable at all. (It will display but the print button will do nothing). I think the method you are calling (.printreport) does just what it says..
Most of the time I work with Crystal on the web..
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Nov 9th, 2000, 10:17 AM
#6
Thread Starter
Frenzied Member
Code:
Private Sub Command1_Click()
Dim SQL As String
SQL = "{Client016.Amps } = 200"
With CP
.DataFiles(0) = ("z:\electric meter department\meter\meter.mdb")
.ReportFileName = (App.Path & "\report1.rpt")
.Action = 1
.WindowTitle = "Client Code Report"
.WindowState = crptMaximized
.WindowShowRefreshBtn = True
.SelectionFormula = SQL
.Destination = crptToWindow
.PrintReport
End With
End Sub
yes i am using the ocx...
no wi get error on .action =1 "unable to load report"
and the report is there...
also i have defualt printer..
-
Nov 9th, 2000, 11:11 AM
#7
Frenzied Member
I was thinking more like:
Code:
Private Sub Command1_Click()
Dim SQL As String
SQL = "{Client016.Amps } = 200"
With CP
.DataFiles(0) = ("z:\electric meter department\meter\meter.mdb")
.ReportFileName = (App.Path & "\report1.rpt")
.WindowTitle = "Client Code Report"
.WindowState = crptMaximized
.WindowShowRefreshBtn = True
.SelectionFormula = SQL
.Destination = crptToWindow
.Action = 1
End With
End Sub
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Nov 9th, 2000, 11:19 AM
#8
Thread Starter
Frenzied Member
i copied and pasted EXACTLY what you put in the last reply
still get error on action =1
the error is still "unable to load report"
-
Nov 9th, 2000, 11:21 AM
#9
Thread Starter
Frenzied Member
i figured out why..
i have crystal report 6 and 8 installed (8 was an update to 6)
i just checked the version of ocx. its using the ocx for 6 not 8
grr
-
Nov 9th, 2000, 09:10 PM
#10
Amazing, so it actually used the older version or
....did you select the wrong one from the components box? We get this occasionally with Agent 1 and 2. Is this a bug in vb?
-
Nov 10th, 2000, 07:22 AM
#11
Thread Starter
Frenzied Member
i couldnt find ocx 8
ocx for crystal report 8 didn't even exist
thats we removed crystal report 6 trrying to install 8
and that messed up other things..
and now my computer has to be taken for maintanance again hehe
stupid vb
-
Nov 10th, 2000, 08:30 AM
#12
Frenzied Member
A top tip for Crystal Reports;
Instead of doing
Code:
Report1.PrintReport
Do
Code:
Dim Reply As Long
Reply = Report1.PrintReport
Then Reply contains the Crystal Error code (if there is one) or 0 if the report printed ok. Crystal is notoriously bad at displaying error messages (ie, it doesn't).
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Nov 12th, 2000, 08:22 PM
#13
Thanks Mark we have started to use your tip
Well another layer of error trapping....bring on vb7
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
|