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!

Error 91 after calling function from dll

Status
Not open for further replies.

philmck

Programmer
Feb 19, 2004
8
GB
I am getting an error 91 (Object or with block variable not set) in my code which I have narrowed down to the point where it exits a function which has called an exported function from a dll.

I have the following line in my main module

Declare Function Lib "C:\winnt\system32\convd.dll" (ByVal inval as Double) as Double


And I have reproduced the error with the following code


Dim doubleval as double
Dim convertedval As Double

Private Sub Command1_Click()
Call test1
End Sub

Private Sub test1()
doubleval = 0.5
Call test2
End Sub

Private Sub test2()
convertedval = ConvD(doubleval)
End Sub

The error seems to occur on exiting test2(). My external function is called correctly as I can see the results. It can be called multiple times successfully but the error always occurs on exiting the function. Strangely, if I move the call to ConvD to inside test1() then the problem does not occur.

Any ideas or advice appreciated.

Cheers
PhilMcK
 
Apologies for the typo in the original post. Should read

Declare Function ConvD Lib "C:\winnt\system32\convd.dll" (ByVal inval as Double) as Double
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top