how to create a dll for an access 2002 application

ike

New member
Local time
Today, 13:15
Joined
Jan 6, 2011
Messages
7
hello, i would like to wrap a lot of functions and routines that a have in my access 2002 application into a dll and call them from my app, is this possible? i could use visual studio and any programming language, but if it's not needed nor possible doing it in a .NET environment i could do it anywhere, just need to do it hehe, thanks in advances
ike
 
is it possible to develop a dll with visual studio and then import the functions it contains from vba in an access app??? that would solve my problem. if it's possible, how can i do it?
thanks
ike
 
I use a mda file, put standard functions in there, set the mda in references and then use the functions from there. If you want to stop the user changing any of these functions create it as a mda file then compile it as a mde file and then change the extension back to mda. KEEP A COPY OF YOUR ORIGIONAL MDA so you can modify if required.
 
thanks for the answer but, i'm trying to put them in a dll couse i would like in the future move to asp.net o a .NET platform, so i'm wondering if its possible to do this, i try the following:
i've develop a dll in .NET with the following code
Snippetusing System;
namespace Test
{
public class Test
{
public static string Prueba()
{
return "from dll";
}
}
}

and i try to call it from vba access 2002 this way:

Option Compare Database
Declare Function Prueba Lib "C:\Test.dll" () As String

Option Explicit
Public Sub test()
Dim a As String
a = Prueba()
MsgBox a
End Sub

and i getting the error 453, cant find dll entry point, any idea to solve this please
??
thanks in advance
ike
 
.NET is not capable of creating DLL's that can be consumed by the Declare Function, only Native Win32 DLL's can be used this way. If you have visual studio you can use C++ and create a native win32 class then register that DLL and Access can use it (assuming you write it correctly).

If you want to use a .NET dll in Access VBA you must register it for COM Interop and reference the *.tlb file that is created. If you are using the DLL on a computer other than where you compiled it you must register it using regasm

regasm.exe %FILENAME% /tlb /codebase
 
thank you very much djkarl, very illustrative your answer, i'll try what you told me, i gonna go the .NET way couse what i would like to do with the app is to move it to the .NET platform and use the vb prog language (that is not my choice hehe but what can i do) so i'm gonna try this approach, once again, thanks, if i have any trouble i would let you know heh ;)
ike
 
djkarl thank you very much!!!! it worked extremely well!!! i'm amazed, there was a moment when i thought that i would never achieve this haha, thanks again
ike
 

Users who are viewing this thread

Back
Top Bottom