×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

RPT to HTML conversion (VB crashes)!!!

RPT to HTML conversion (VB crashes)!!!

RPT to HTML conversion (VB crashes)!!!

(OP)
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 "Yeeee, hoooooooooooo!"

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close