Nevermind, I change A.DoCmd.RunMacro to A.Run to run function itself and it worked fine.