Hey guys!
so first thing first...
i have an access 2013 database (accdb) which hold single table, "Users".
using the data macro tool of ms access, i wrote an AfterUpdate data macro which call the 'SetLocalVar': the name i called it is 'Run' and the expression is a function i wrote in VBA, called 'ActivateSmsCenter()'. this function runs ShellExecute function that activate an exe file.
beside the database, i have a booking managment software that does manipulation on the database.
basically, i need whenever field is changing in the 'Users' table to run the AfterUpdate data macro.
Now, when i change a field manually through the database, the macro triggers.
if i change the field through my main software using OleDbCommand, the field changes but the macro wont fire. because of that, i needed to write 'RunMacro' function in my software which looks like this:
Dim oAccess As Access.Application
oAccess = CreateObject("Access.Application")
oAccess.Visible = False
oAccess.OpenCurrentDatabase("C:\Users\oron\Desktop\DataBase Listening\LocalDB.accdb", False)
oAccess.Run("ActivateSmsCenter")
oAccess.DoCmd().Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oAccess)
oAccess = Nothing
The problem is that this is a very bad idea. our software contains over 1.5 milion code line and i cant call this function in every function. i need it to be trigered automatically.
my Q is how can i fire the datamacro without calling the 'RunMacro' function or in other words, why my macro wont fire when changing the field using code?
thanks alot,
oron.