Results 1 to 1 of 1
2008-06-26, 21:02 #1
- Join Date
- Jan 2001
- austin, Texas, USA
- Thanked 0 Times in 0 Posts
calling a dll in VBA module (Access 2003, XP Pro S
<font color=red>Problem solved - my code had a misconfigured loop</font color=red>
I am trying to adapt some code that uses a dll to process a set of records. the code samples are in C++, .NET and VB 6. the sample projects use a dll to verify or process a text file containing fixed-width data. Ultimately, I want to devise some system that can read and evaluate the data using the dll, and my first stab at this was to move the VB 6 code into an Access module. this "works" in the sense that on run Access freezes completely. I don't know if I can make it work in Access at all but do want to try.
So! My initial question is, "how do I reference a dll in VBA" and the follow-up to this would be "are there good reasons to suspect this is not possible in Access"?
Here's the way I am trying to do it:
<font face="Georgia">Private Declare Function RugCalc Lib "C:CMS_RUGRug520.dll" _
Alias "_RugCalc@64" (ByVal sMdsRecord As String, ByVal sRehabType As String, ByVal sModel As String, ByVal lQuarterlyFlag As Integer, ByRef nCmiArray As Double, ByVal sRugHier As String, ByVal sRugMax As String, ByRef lRugHier As Integer, ByRef lRugMax As Integer, ByRef nCmiValueHier As Double, ByRef nCmiValueMax As Double, ByRef lAdlSum As Integer, ByRef lCpsCode As Integer, ByVal sRugsVersion As String, ByVal sDllVersion As String, ByRef lError As Integer) As Integer</font face=georgia>
According to the instructions, this particular dll is written in C++ and cannot be registered in Windows. The sample code works if the dll and the target text file is in the application directory. Compiling the .NET code gives the error "cannot locate dll" even though the compiled .NET exe runs with no errors (but only if run on the C: drive, not a network share).
This may be more appropriate in the VB board but I'd like to implement the code in Access so thought I'd try here first.