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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

App locking up VB 6 completely

Status
Not open for further replies.

icodian

IS-IT--Management
Aug 28, 2001
74
US
I recently wrote a small app that runs a Crystal Report, exports it to a file, and emails it to a fax client which faxes it out. This is written in VB6 using Crystal 8.5.

I have a strange problem where the application locks up VB after it has completed its execution. Basically, I press the GO button, it does all the processing properly, and the emails are sent out successfully. I stepped through the code and everything in it executes properly. I get down to the End Sub line. Upon "executing" this line, VB locks up completely.

I have let it sit for about 20 mins expecting something to happen but invariably must end the task.

Does anyone have any suggestions as to what to look for to fix this?

Thanks for any help!
 
Make sure any Recordsets and Database connections you have are being closed.

Good luck,
Kevin
 
Thanks for the post.

You bring up a point that I neglected to mention in the previous post.

I was initially having the exact same problem in the middle of the code. There is an object I was setting to nothing that was originally giving this problem.

Here is the object and it's only references. The app (& VB) were locking up on the final command that was located at the end of a loop that was running.

Dim crTable As CRAXDRT.DatabaseTable

While Not....
blah blah blah...

Set crTable = crTables.Item(1)
crTable.SetDataSource rsCust, 3

blah blah blah...

set crTable = nothing (locked up here originally)
Wend

Upon commenting out the line (set crTable = nothing), I then received the error at the End Sub line.

Thanks again.
 

icodian, I hope that is a misstype of yours. Meaning...
[tt]

set crTable = nothing (locked up here originally)
Wend
[/tt]
You are not done with the object and you are still in the loop and you are removing the object from memory and then trying to use it again. The set object = nothing should be out side of the loop.

Good Luck

 
Thanks for the tip. I'm not a regular programmer so forgive my inexperience. I moved the line you mentioned outside of the loop as suggested.

Unfortunately, it still hangs up on that line. I am not even able to CTRL-Break out of it.

I'll mention again that commenting out that line doesn't seem to help because it still locks up after the code executes. Strange behavior...

Thanks again for any help.
 
likewise, you create the object many times... that may cause some issues. Try moving the
Code:
Set crTable =  crTables.Item(1)
to just oustside the top of the while loop, as currently you are createing the same object multiple times in the loop (major performance hit it nothing else)



Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top