Elmar

Elmar

  • NA
  • 11
  • 0

How to eun Microsoft Access method/function with parameters from C# app

Sep 14 2012 12:25 AM

this works fine -

Access.Application acApp = new Access.ApplicationClass();
acApp.OpenCurrentDatabase(@"C:\temp\db1.accdb",false ,null);
object oMissing = System.Reflection.Missing.Value;

acApp.Run("ABC",ref oMissing,ref oMissing,ref oMissing,ref oMissing,
ref oMissing,ref oMissing,ref oMissing,ref oMissing, ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing ,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing ,ref oMissing,ref oMissing);
acApp.Quit();

but I need to pass a few parameters to ABC

acApp.Run("ABC('par1', 'par2')", .... or acApp.Run("ABC 'par1', 'par2'", ..... generate error message "Could not find method  ABC('par1', 'par2')