Calling DLL's

Matthew Snook

NW Salmon Database
Local time
Today, 20:52
Joined
Apr 19, 2001
Messages
133
Hello:

This code works in VB6.0 as long as the ZP4.DLL is in the same directory as the VB project. But when I try the same thing in VBA in my access project, it breaks at "ZP4StartSession" and I get "Sub or Function not defined." Where should I put the DLL in order for the VBA code to see it?I've put it in the directory with the .mdb file and in with msaccess.exe, but neither one will recognize the call.

Thanks,

Matt

Dim buffer As String * 1000 ' create buffer big enough for output records
Dim session As Long ' handle for DLL calls
ZP4StartSession session
If session = 0 Then
MsgBox "Calling ZP4.DLL failed!"
Exit Sub
End If
 
I'm assuming that you are declaring the library before accessing a function. If not, look up declare under Access help for the parameters.

Try putting the DLL in the windows\system folder.
 
You assume too much! One of the dangers of being a "cut-and-paste" programmer is that I don't always have the big picture... I was attempting to convert some VB code into VBA, and did not understand completely how VB works. So I missed the ".bas" module with the declarations!

Thanks again for your help and pertinent suggestions. Now I'll go read some more.

Matt
 

Users who are viewing this thread

Back
Top Bottom