Andy Brown
asked on
Interfacing MS Access with an external DLL/COM object created in C#
I have an MS Access database and need to interface with a C# DLL that is about to be created for me (as a COM object). My C# guy has no experience in interfacing with MS Access, and I have only interfaced Access with COM objects that I have purchased (EASendMail etc).
We have run a few tests, and I can half interface with his test DLL (once referenced), but the Intelisense isn't working correctly. However, whilst I am sure that we can overcome that one easily enough, it's the return messages that I am struggling to get my head around. How do I tell Access to listen for them and then, trigger an event/function?
I know this is a little vague - but I could really do with some pointers to get started.
We have run a few tests, and I can half interface with his test DLL (once referenced), but the Intelisense isn't working correctly. However, whilst I am sure that we can overcome that one easily enough, it's the return messages that I am struggling to get my head around. How do I tell Access to listen for them and then, trigger an event/function?
I know this is a little vague - but I could really do with some pointers to get started.
ASKER
Thanks John. I agree that the reference issue will be the DLL side of things (as mentioned the c# developer is great in certain areas - but this is new to him). However, the big issue is how the DLL pushes information back into Access so that Access can do something. So, I guess we're looking for a guide/best-practices approach for .Net.
Initially, I wanted us to create a function that allowed users to press a 'Call' button on the Access DB and then monitor for the connection/returned signals being received. We have already created a service that can initiate the call from a command line prompt and then I get Access to periodically check an XML file, which has the end-of-call status. This does work - but, it's not slick and I want to be able to do more than just Call a number, so getting a way to send/receive signals cleanly is essential.
Initially, I wanted us to create a function that allowed users to press a 'Call' button on the Access DB and then monitor for the connection/returned signals being received. We have already created a service that can initiate the call from a command line prompt and then I get Access to periodically check an XML file, which has the end-of-call status. This does work - but, it's not slick and I want to be able to do more than just Call a number, so getting a way to send/receive signals cleanly is essential.
The Dll should return an object...then you should cast the object to the type you want it..
Put a breakpoint and check what you get in the Watch window
Put a breakpoint and check what you get in the Watch window
ASKER
Thanks again John - I understand what you are saying - but we can't seem to get that far. Do you know of any simplistic examples VBA/.NET/VBA?
Check this example here
How do I tell Access to listen for them and then, trigger an event/function?
The answer is you don't. Just like calling a function in VBA, you would get a return value. ie.
intRet = SomeFunction()
It's not class based processing where you'd create an object based on a class, and then potentially hook that into events with "With Events". It's more like calling something in the Win API.
Jim.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, everyone - sorry for the delay in coming back to you. That should give us enough information to move forward.
If you give a rough outline of what you want to accomplish along with some sample code it would be easier to get a useful answer.