Hi Friend,
I have an application in VB 6 with Crystal Reports 7. Once I deploy the application using Package & Deployment Wizard, I get the error 'Automation Error' when I call the report from VB. I have deployed the .rpt file and not the complied file. I get this error occationally and not always. I also use Selection Formula, and Replace Selection Formula, both in VB code and also in the Report. Other reports function normally but just this one report gives me problems.
Have you come across this problem or do you have any idea of solving this ?
Please let me know if you do.
Bye.You might be missing a required dll.|||omalley might be right...............but it can be about a thousand things in CR - the error traps are so generic...:-(
I've seen this type of error when referencing objects in VB that are nor correctly type, for example.
eg dim myObj as Object
dim myObj as CRAXDRT.Report (which is the correct way to expose a report object and its properties and avoid the iUnknown interface on the COM layer, as I recall.)
It can also occur when automation servers used by CR are not available for some reason. I use some of my own UFLs (user function libraries that I developed in VB), which end up being exposed as "Additional Functions" in the formula editor. Any dll's with prefix UFL MUST be in same location as crpeaut32.dll or they will operate unreliably, even though properly registered using regsvr32.
Check also that your installation doesn't have some distributables on a network drive.
Once you've done that, make sure that you have properly passed your login info to the report in your code, and that you have also passed it to any subreports. This is a trap that bites many CR users - your database security may require you to supply login info to each subreport. It will also vary from OS to OS - standard XP security is much fussier than ME, for example.
As you can isolate it to a particular report that fails, are you doing anything differently to other reports, ie passing a different type of parameter, or maybe a range of parameters instead of a single one, and so on? Or maybe a different user is experiencing the problem.
Failing that, check the event log on the PC and see what information it is returning regarding the automation failure, and post that here.
Dave|||Thank You, omalley and springsoft for your comments. The code I use is given below;
'*****
CR.ReportFileName = App.Path & "\RouteCard.Rpt"
CR.DiscardSavedData = True
CR.Reset
CR.DiscardSavedData = False
CR.WindowShowRefreshBtn = True
CR.WindowShowSearchBtn = True
CR.WindowShowPrintSetupBtn = True
If CmbWoNoFrom.ListCount = 0 Then
MsgBox "No Records", vbInformation
Exit Sub
End If
ab = False
st1 = "({TblSchedulinghdr.Cancelled} = 0 and {TblPartNoWorkOrderNo.Cancelled}=0) and {TblOrderAcceptanceDetail.Move}='MOVE' "
If Trim(CmbWoNoFrom) <> "" Then
st1 = st1 & " AND {TblSchedulinghdr.SequenceWONo} >= " & Val(CmbWoNoFrom)
End If
If Trim(CmbWoNoTo) <> "" Then
st1 = st1 & " and {TblSchedulinghdr.SequenceWONo} <= " & Val(CmbWoNoTo)
End If
If Trim(CmbFinancialYear) <> "" Then
st1 = st1 & " and {TblSchedulinghdr.FinancialYear} = '" & UCase(Trim(CmbFinancialYear)) & "'"
End If
CR.SelectionFormula = st1
CR.Action = 1
'****
I use a database on the network which connects through ODBC and there is no database passwords set. There are 6 sub reports on this report and only one user gets this error at times. This package is compiled on win 2000 and deployed on win98.
Please let me know if you have any clue.
Thanx.
Bye.|||John,
Only potential problem I can see here (and it may not actually be a problem because you have given us a code snippet, not the whole lot), is that you are using combo boxes, by the look of your variable naming notations (which bears some resemblance to Charles Simonyi's Hungarian C Notation, with an indicative type prefix on variable and object names).
If CmbWoNoFrom (for example) is actually a combo box, what are you doing to trap situations where user presses Print button without actually selecting an item from each combo?
Unless you have a default value already set, and it doesn't look like you have, as you are Val'ing the combo's selection, then a failure to select the value may cause the query to fail, because it is passing a value (probably -1) that the query can't handle.
Dave|||Thnak You springsoft for your observations.
I don't think an empty combo box would produce an error as the check for an empty trimmed combo is done before the expression is built. This particular machine had some virus problems and also has a keyboard device driver alert in device manager. Does this pose any potential problem, although I feel it should'nt.
Please let me know of your views.
Thanx.
Bye.
Showing posts with label crystal. Show all posts
Showing posts with label crystal. Show all posts
Thursday, March 29, 2012
Automation Error when called from VB 6
Sunday, March 25, 2012
Automatically Preview reports
Hi all. Great Forum by the way
I have a question. I have some crystal reports that people open via a hyperlink on a web page. This brings up the crystal report but people have to then "refresh" or "run" the report themselves. They are then prompted for a "start" and "end" date for report.
Is it possible to have the report automically open prompting for the start and end dates? In other words open and run automically?
Regards
Johnu didn't mention what u r using to develop web pages.
If asp.net then use crystalreportviewer control it should automatically prompt for parameters.
Make sure u r not saving data with report.
I Hope this helps..
I have a question. I have some crystal reports that people open via a hyperlink on a web page. This brings up the crystal report but people have to then "refresh" or "run" the report themselves. They are then prompted for a "start" and "end" date for report.
Is it possible to have the report automically open prompting for the start and end dates? In other words open and run automically?
Regards
Johnu didn't mention what u r using to develop web pages.
If asp.net then use crystalreportviewer control it should automatically prompt for parameters.
Make sure u r not saving data with report.
I Hope this helps..
Thursday, March 22, 2012
Automatically Add date Range - 7 Days
Hello,
I'm writting a Crystal report on all order sent out in the past week.
I all works fine, but I am now trying to take away all the steps I can to make it easier and quicker to run.
The report has to inputs, the ClientCode and the Date Range.
Is there any way/Code that I can use to replace the need to input a date that will get the report to take todays date as the End range ( which is does at the moment ) and the - 7 days and use the result as the Start Range?
Thanks in advanceYou could use the LastFullWeek function in your record selection.
{table.field} = LastFullWeek
GJ
I'm writting a Crystal report on all order sent out in the past week.
I all works fine, but I am now trying to take away all the steps I can to make it easier and quicker to run.
The report has to inputs, the ClientCode and the Date Range.
Is there any way/Code that I can use to replace the need to input a date that will get the report to take todays date as the End range ( which is does at the moment ) and the - 7 days and use the result as the Start Range?
Thanks in advanceYou could use the LastFullWeek function in your record selection.
{table.field} = LastFullWeek
GJ
Monday, March 19, 2012
Automatic page numbering
We are using Crystal 10 and at the bottom of each page are using the automatic page numbering (page X of XX) . We have a report footer that only occurs on the last page of the report. When the last page contains only this footer, the automatic page numbering does not work properly. The first page says 1 of 1 and the second page also says 1 of 1. The automatic page numbering does not pick up on the fact that the report has 2 pages and generate the numbers properly. Any suggestions.Use this forumula
WhilePrinitingRecords;
Numbervar N;
N:=N+1'
And place this in Report footer
WhilePrinitingRecords;
Numbervar N;
N:=N+1'
And place this in Report footer
Subscribe to:
Posts (Atom)