Results 1 to 7 of 7

Thread: unhandled win32 exception in vb6.exe

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    4

    unhandled win32 exception in vb6.exe

    Hi all,

    i have a problem where i have a recordset of about 200 records containing customer names, for each record, i have to open a crystal report passing the recordset data as parameter and then exporting that report to html format (4.0)

    main problem is that when i run the program it works fine for few records and then it gives an error
    "Unhandled win32 exception occured in vb6.exe[7828] "
    and thus terminating the program.

    this error appears randomly sometimes after 15 records and other times after 50+ records.

    i am attachign the code with this thread please havea look at the code and do suggest me a solution. it looks as if its related to memory management.

    thanks in advance.

    regards,
    atin...


    code

    Private Sub Command1_Click()
    On Error Resume Next
    stdt = CDate(strStDt)
    seldt = CDate(strSelDt)

    'rs is recordset db is connection object

    rs.Open str1, db, adOpenDynamic, adLockOptimistic
    Set cry = New CRAXDRT.Application
    ReDim strCS(1 To rs.RecordCount)
    For i = 1 To rs.RecordCount
    strCS(i) = rs.Fields(0)
    rs.MoveNext
    Next i

    rs.Close
    Set rs = Nothing
    db.Close
    Set db = Nothing


    Set rep = cry.OpenReport("DtrList-xbndrstatement.rpt")

    For i = 1 To UBound(strCS)
    rep.EnableParameterPrompting = True
    rep.DiscardSavedData
    rep.ParameterFields.GetItemByName("seldate").AddCurrentValue seldt
    rep.ParameterFields.GetItemByName("stdate").AddCurrentValue stdt
    rep.ParameterFields.GetItemByName("stCus").AddCurrentValue strCS(i)


    With rep
    .ExportOptions.FormatType = crEFTHTML40 'exporting to html format'
    .ExportOptions.DestinationType = crEDTDiskFile
    .ExportOptions.HTMLFileName = "C:\" + strCS(i) + ".html"
    .Export False
    End With

    Next i
    Set rep = Nothing

    cry.CanClose
    Set cry = Nothing

    End Sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: unhandled win32 exception in vb6.exe

    Welcome to the forums.

    Step 1: Remove On Error Resume Next

    What line does it blow up on?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    4

    Re: unhandled win32 exception in vb6.exe

    i have removed the line 'On error resume next'
    what next do i have to do?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: unhandled win32 exception in vb6.exe

    What line in your code is causing the error?

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    4

    Re: unhandled win32 exception in vb6.exe

    Hi,

    i do not know whcih line of the code is causing the error, problem is that when i run this code, it opens crytal report and exports it to html format and saves it in a folder, but it does only for few records and then sudenly gives an error.

    number of records is also not certain, sometimes it runs for 15 records whereas othertimes it runs for more than 50 but it does given an error after 50-60 records.

    its totally random, luks like there is something wrong with memory management in the code.

    thanks

  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    4

    Re: unhandled win32 exception in vb6.exe

    anyone there?? pls help me out guys

  7. #7
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: unhandled win32 exception in vb6.exe

    Try not exporting to HTML... also is behavior consistent with record count or consistent with duration (possible timeout)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width