Reputation: 973
I've a Winforms C# application from which I'd like to be able to connect to an Access 2007 application. Basically, users click a button in the winforms app, and they're taken to a specific form within a MS access application they have running.
Is this possible?
Thanks
Upvotes: 1
Views: 1350
Reputation: 43046
As an alternative to using DDE, consider automation. You'll need to add a reference the relevant PIA libraries, and then you can have code somewhat more familiar to an Access developer, like this:
var access = new Access.Application();
access.OpenCurrentDatabase("MyDB.accdb");
access.OpenForm("frmNavigate");
Upvotes: 2
Reputation: 3060
Yes it is possible. You will have to use DDE. Ugly old technology but it is still in Access 2007. I am using the NDde library on codeplex.
using (DdeClient client = new DdeClient("MSACCESS", "MyDB.accdb"))
{
String DdeCommand =
"[OpenForm frmNavigate,,,,,,UserOpenArgs]";
try
{
client.Connect();
client.Execute(DdeCommand, 5000);
}
catch (NDde.DdeException ex)
{
// MessageBox.Show(ex.Message);
Logger.Write(ex.ToString());
}
}
Upvotes: 0