?
Solved

Crystal Report Export Problem from Visual Basic 6.0

Posted on 2003-03-17
10
Medium Priority
?
833 Views
Last Modified: 2013-11-25
Hi!

I am generating some weekly reports in Crystal Reports and exports it to RTF (Disk File).  I have one text file which displays min:sec.  I need to do an average on min:sec for 7 days.  For that I have created some formula's using ToNumber, ToText, etc.  If I export it from crystal report it exports fine.  But when I am trying to export through VB automation it gives me runtime error-'2147191667(8004748d): The String in non-numeric'.  

VB Code :

Set crxExportOptions = Report.ExportOptions
crxExportOptions.FormatType = crEFTExactRichText
crxExportOptions.DestinationType = crEDTDiskFile
crxExportOptions.DiskFileName = "C:\Reports\Weekly.rtf"
Report.Export False

Initially when I was not displaying the average for min:sec the above vb code was running fine.  
Anyhelp is appreciated.  Thanks,
0
Comment
Question by:priraj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 8155975
Can you open the report in Crystal and preview it?  If so can you then export it as you want?

I suspect the problem is not with VB or the exporting but with the formulas you created.

Can you provide the formulas?

mlmcc
0
 

Author Comment

by:priraj
ID: 8159703
Hi!

I can preview in crystal reports and can export it from crystal reports and it runs fine.  Only error occurs when I try to run my automation.

ToText ({@minutes}) + ToText (".") + ToText ({@seconds})

if  {@sec} < 10 then
   ToText (ToNumber (0)) + ToText (Int ({@sec}))
else
    ToText (Int ({@sec}))

Do you think there might be any problem in above formula.  Although it runs fine with no errors in crystal reports itself.
0
 

Author Comment

by:priraj
ID: 8159821
Hi!

I can preview in crystal reports and can export it from crystal reports and it runs fine.  Only error occurs when I try to run my automation.

ToText ({@minutes}) + ToText (".") + ToText ({@seconds})

if  {@sec} < 10 then
   ToText (ToNumber (0)) + ToText (Int ({@sec}))
else
    ToText (Int ({@sec}))

Do you think there might be any problem in above formula.  Although it runs fine with no errors in crystal reports itself.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 101

Expert Comment

by:mlmcc
ID: 8161757
Try
if  {@sec} < 10 then
   '0' + ToText (Int ({@sec}))
else
   ToText (Int ({@sec}))

mlmcc
0
 

Author Comment

by:priraj
ID: 8168394
Never Mind!  I got the answer.  Actually I tried quiet similar what you mentioned but that too gives me the same error when I run my automation.  I checked all my formula's and everything worked fine in crystal reports, so I if condition and checked if it's true then proceed else display 0.  I am not sure what difference it makes but now my automation run fine.  
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8170365
If we helped please award the points.  If not then submit a request in the Community Support forum to PAQ this question

mlmcc
0
 

Author Comment

by:priraj
ID: 8205560
Hi,

I found the answer by my self.  I am not an expert in VB or crystal reports but I found that VB is not able to interpret the numeric into text.  In crystal reports my mentioned command worked fine but not through automation.
ToText ({@minutes}) + ToText (".") + ToText ({@seconds}).
Eg. In crystal reports I get 25.20 and I could perform Mathematics calculation and the result comes fine but,
Through VB Automation I get error as instead of getting 25.20 results shows 25.00.20.00 and will not be able to perform any calculation.  What I did is instead of converting into text and then to Number I did some maths calculation to get the same result and it worked fine in both crystal reports and vb automation too.  

I don’t think I need to give my point to any one as I got answer from myself.  I would like to PAQ this question.

0
 

Expert Comment

by:CleanupPing
ID: 8532146
Hi priraj,
This old question (QID 20553969) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8537545
As I suggested  

then submit a request in the Community Support forum to PAQ this question


mlmcc
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8537919
PAQ'd and points refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question