This code runs fine on my machine. Strip yours down and see what happens. Does your error handler create any objects?
lcOldError = on("error")
lerror = .f.
on error lerror = .t.
with thisform
.osmtp.Host = "badhost.airmail.net"
.osmtp.Connect()
on error &lcOldError
if .osmtp.lasterror > 0
.release()
endif
endwith
>It's the SMTP/X control.
>
>I know it's not connected because I pass it a bogus host name (This.omailer.Host = "Shite") - and then I step through the code, get the last error property from the control, ect.
>
>FYI - This app is used internally to parse a 50-80MB report file and e-mail pieces of it to various credit unions - the file(s) credit unions are provided with by this program are used as input into an ATM/POS Reconciliation system we built.
>
>What I want to happen is for the user in our Operations department to be informed that there is a problem with Exchange Server - (i.e. nothing wrong with the program) and inform them to contact Network Support in the event that they are having problems connecting to Exchange server. Of course I also want to close the current form so that processing cannot proceed without a connection to the Exchange Server.
>
>Al
>
>
>>hmmm...
>>
>>Is this the POP/X control?
>>
>>Perhaps it is really connected. What happens if you call this.omailer.disconnect() before thisform.release()?
>>
>>What blocking mode on Mail/X are you using? Toggle it to the opposite and give it a whirl.
>>
>>
>>>Steve,
>>>
>>>Thanks for your suggestions.
>>>
>>>oMailer is actually an olecontrol - Mabry's MailX control. If I try to issue this.omailer = NULL, I get error message 1737 = 'OMAILER is a method, event, or object.'
>>>
>>>I'm not so sure that this control is the problem - and I'm having a difficult time wrapping my head around 'dangling references'. I've read a few threads on the topic and I still don't get it. Any suggestions on how I should move forward - (i.e. determine which dangling reference(s) is prohibiting my form from closing...)
>>>
>>>I appreciate your assistance. Thanks again.
>>>
>>>Al
>>>
>>>>No, running the form via 'DO FORM' should not cause this problem. This is a SWAG...I would try
>>>>
>>>>
this.oMailer = NULL
>>>>thisform.release()
>>>>
Steve Gibson