Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RPT to HTML conversion (VB crashes)!!!

Status
Not open for further replies.

mthakershi

Programmer
Aug 24, 2001
79
US
Hi Dudes,
While facing one major problem of using pdssql.dll from ASP, I pasted the same vb script code in vb and tried it out.

When I called Export(Boolean) method on report object with arguement false (to not prompt any dialog for selecting options) for converting reports to html, VB crashed everytime. If I was passing true to this method then only html conversion was being done.

The above thing never happened with any other format type. Only HTML had the problem. So if someone faces same problem answers to this post can help them out (me too). Here is code snippet.

Set oApp = CreateObject("CrystalRuntime.Application")
oApp.LogOnServer "pdssql.dll", "zeus", "TEMPTEST", "sa", ""
Set oRpt = oApp.OpenReport(path & reportname, 1)

oRpt.DiscardSavedData

oRpt.SQLQueryString = CStr(strSt)
oRpt.MorePrintEngineErrorMessages = False
oRpt.EnableParameterPrompting = False


FileName = "malay.html"
FileType = "HTML"

Set objExp = oRpt.ExportOptions
ExportFileName = "c:\" + CStr(FileName)
objExp.DestinationType = 1

Select Case FileType
Case "HTML":
ExportType = 24
End Select

objExp.FormatType = ExportType

If (CInt(ExportType) <> 24) Then
objExp.DiskFileName = ExportFileName
Else
objExp.HTMLFileName = ExportFileName
objExp.HTMLEnableSeparatedPages = False
objExp.HTMLHasPageNavigator = True
End If

If CInt(ExportType) = 10 Then
objExp.NumberOfLinesPerPage = 50
End If

oRpt.Export False
'here in HTML case if I pass False VB crashes
'if I pass true to open selection dialog it works

MsgBox &quot;Yeeee, hoooooooooooo!&quot;

First I thought let me put this as Helpful Tip but then I thought I may be wrong and something was missing to export report to HTML. Anyway this might help to some people just as I knew it.

Thanks,
Malay M. Thakershi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top