This is an demostration of how to implement .NET components for Access/VBA consumption. The package should include the following: 1) Access .MDB file "BigMathInAccess" 2) Source code for "IntX VB" with file BigInt.sln 3) Powerpoint file "Extending Access Application with .NET" To use this, you will need the following (adjust as necessary for versions): Access 2003 Visual Basic 2005 Express Edition (available for download from MSDN) Mircosoft .NET Framework 2.0 redistributable version. (available for download from MSDN) This shows how to create a wrapper class to implement a .NET library for use within Access environment. The general steps involved are: 1) Creating a new project & adding a reference 2) Examining the library and deciding on methods that need to be exposed 3) Examining the data types used and whether they are compatible or needs to be substituted 4) Writing out the wrapping method that is useable for Access and can call library's methods 5) If desired, implementing interface and specifying attributes to enable early binding. 6) Building the wrapper 7) Registering the wrapper 8) Notes regarding strong naming and distributing Note: Wrapper class is not the only way to implement .NET component, merely just a simple way without all the extra hassle involved. 1) Creating a new project & adding a reference To create a new blank project for wrapper class, in Visual Basic 2005: a) File -> New Project b) Select "Class Library" template. c) Give it a good name and save it. NOTE: If you have full edition, you can choose COM Class template instead. To add a reference to .NET library you want to implement for your application a) Project -> Add Reference b) Select "Browse" tab and browse to the library DLL file you want to use and click OK. c) For the class, add this at the declaration: Imports [library's name] 2) Examining the library and deciding on methods that need to be exposed Use Visual Studio's object browser to examine the library after you've added it as a reference. Press F2 to open the object browser. You may need to navigate to the library's namespace or use "Custom Component" to make sure you have the library selected. Take note of methods that you will need to satisfy your application's requirements. 3) Examining the data types used and whether they are compatible or needs to be substituted For each methods, take note of data types used. If the library will deal with data that will be saved as a record, Jet data type should be used as a basis of comparsion as Jet is more stringent than VBA. Otherwise, VBA can be just ued. In case of incompatible data type, decide on an appropritate subsitution. For custom data type, take caution as VBA may or may not accept; it's generally easier just to send the compatible data type, convert into the custom data type *within* the wrapper class and back than it is to manage the custom data type within VBA. 4) Writing out the wrapping method that is useable for Access and can call library's methods With the methods listed and data type mapped, you should be able to write out methods.At a minimum, a wrapping method will look something like below: ================================================= Public Function Example(Argument As DataType) Return LibraryMethod(Argument) End Function ================================================== This is assuming that LibraryMethod uses a compatible data type. Within VBA, it would look as below: ================================================== Public Sub InVBA() Dim Argument As DataType Argument = Something Debug.Print Example(Argument) End Sub ================================================== So from VBA, we call Example method in the wrapper class which in turns call the actual library's method to process Argument into something we want, then return to wrapper class which then returns to VBA to be printed out in the immediate windows. For more details, refer to LateBigInt.vb within BigInt.sln in Visual Studio for example on how this is done. 5) If desired, implementing interface and specifying attributes to enable early binding. If you want to enable early binding, the additional steps are necessary: Creating an interface Defining attributes. Refer to the source code within BigInt.vb in Visual Studio for examples of what are required. 6) Building the wrapper In Visual Studio: a) Project -> Properties b) On Application tab, click button "Assembly Information" c) Check "Make assembly COM-visible" and press OK. d) On Build tab, set the Output path to whereever you want to for production. All clients machine must share same path. NOTE: If using C# express, the tab is "Compile" d1) If you have full edition or C# express edition, check "Register for COM-Interop" box e) Build -> Build solution. (Note: If you've already built, use Rebuild All instead) 7) Registering the wrapper NOTE: If you checked the box for "Register for COM Interop" you can skip this step. See #6 for info. Using cmd.exe (Command Prompt), issue the following commands: cd c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 regasm [SamePathWhereWrapperClassWasBuiltTo]\LibraryName.DLL /tlb: [SamePath]\LibraryName.TLB /codebase You will get a warning if the wrapper class is not strong named. See next section for more details. 8) Notes regarding strong naming and distributing Microsoft recommends that any .NET source code (assembly) be digitally named, or in .NET parlance, "strong named". You can create your own strong name by going to Signing tab in project's properties in Visual Studio and creating your own file then checking "Sign my assembly". Note that this will not work if the class references any library that are not likewise strong named. You would have to in turn strong name the reference library first then the wrapping class. Or, you can just ignore the warning. If you do choose to do so, it is good idea to document the fact and notify IT because whenever there are any other .NET assembly that may have same namespace, there will be conflict created.