Error Propagation In Access

Feb 25, 2015 at 6:05 PM
Hello,

I am using NetOffice for a project where I have a VB macro in an access data base. While I can call the macro, if there is an error, it does not propagate the error or return an error but instead prompts me with a dialog box to debug. I would like to set this project to run unattended. How can I accomplish this where I get an error from my VB Macro instead of a debug dialog.

Thank you,

PS:

Here is the code I am using
void Main()
{

    using(var accessDB = NetOffice.AccessApi.Application.GetActiveInstance() ?? new NetOffice.AccessApi.Application())
    {
        try
        {
            accessDB.OpenCurrentDatabase(@"C:\Database2.mdb");
            using(var database = accessDB.CurrentDb())
            {               
                try
                {
                    accessDB.DoCmd.RunMacro("Macro1");
                }
                finally
                {
                    database.Close();
                }
            }
        }
        finally
        {
            accessDB.Quit();
        }
    }
}