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

ActiveX Object Errors.

Status
Not open for further replies.

SeeThru

IS-IT--Management
May 2, 2002
585
GB
Hi All

Access97 running on Win98,2k, XP

I've got an ActiveX tapi dialer program that I have on a contacts form. An object is created and bound on the form load:

Code:
Private WithEvents tEx As TAPIEXLib.TAPIExCtl
Private Line As TAPIEXLib.ITAPILine

Dim intDevID As Integer

Set tEx = New TAPIEXLib.TAPIExCtl
tEx.Initialize

(section to select correct intDevID)

Set Line = tEx.GetLineFromDeviceID(intDevID)

This works fine. The line object needs to be available all the time the form is open (it monitors the line for incoming calls).

This code will work fine for a while, but then I get an error 91: "Object variable or With block variable not set" on the Line object - it seems to lose the connection to it. you cannot even test for the status of the line object - it does not exist at all.

Anyone know what could cause an object to go out of scope while the form remain open?

The form is very complex, and what is very frustrating is I cannot get it to recreate the error - it seems to occur randomly every few hours of use, and never on my test system!

the tEx object seems to be retained fine.
 
What you can do, is you can capture the error in an error handler function and if you get this error, then you can either reinitialise the object. Try this to get around the problem.....

I am not familiar with TAPI, has it got anything to do with Telephone connection or anything. Does the hardware bit has anything to do with losing your connection. May be you could take a look at that aspect as well... since you are saying that the error does not occur in your test system.
Hope this helps
 

Thanks for the suggestion - I have a workaround at the moment that sort of works, but only on outbound dials - it triggers when the user hits the dial button and get the error as the line object is missing.

On inbound, it doesnt see the line, so doesnt see the call, so doesnt trigger the record lookup functions.

I think I'll have to do as you sugguest, and write an error handler for this error - I'll get it to run in the OnCurrent and possibly OnTimer as well.

I know it is not likely to be hardware error as we also have a stand-alone tapi program that is connected to the same device and doesnt lose the connection. Unfortunately it is not ActiveX and doenst make it's capabilites available to VBA.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top