|
-
Jul 1st, 2008, 06:07 AM
#1
Thread Starter
New Member
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
-
Jul 1st, 2008, 06:13 AM
#2
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?
-
Jul 1st, 2008, 06:28 AM
#3
Thread Starter
New Member
Re: unhandled win32 exception in vb6.exe
i have removed the line 'On error resume next'
what next do i have to do?
-
Jul 1st, 2008, 06:35 AM
#4
Re: unhandled win32 exception in vb6.exe
What line in your code is causing the error?
-
Jul 1st, 2008, 07:42 AM
#5
Thread Starter
New Member
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
-
Jul 2nd, 2008, 03:45 AM
#6
Thread Starter
New Member
Re: unhandled win32 exception in vb6.exe
anyone there?? pls help me out guys
-
Jul 2nd, 2008, 04:55 AM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|