To write managed code for use in Access, you can use one of the Visual Studio editions such as Visual Studio 2005, Visual Basic 2005 Express Edition, or Visual C# 2005 Express Edition. There are two distinctly different approaches you can take when writing managed code for use in Access:
Write a class library that defines classes that you can reference from your Access application.
Write a COM add-in that contains user interface code and allows you to launch it when Access starts.
The following sections explore both of these approaches.
When you write a class library using managed code, Visual Studio creates a DLL for you that contains the classes you have defined. However, the DLL is actually an assembly managed by the CLR. Because the DLL contains managed code, referencing it in Access produces an error, as shown in Figure C-1.
Instead, the .NET Framework allows you to create a type library that you can reference from VBA. These type libraries are compatible with COM applications such as Access.
If you want to extend your Access application to write to the Windows event log, for example, you could use the Windows API or the EventLog class in the .NET Framework, which is much simpler to write.
The examples in this appendix were created using Visual Studio 2005, but can also be created using the Visual C# ...