MS Access RunCode Macro cannot find my procedure

calendar_today Asked Jun 21, 2013
thumb_up 15 upvotes
history Updated April 16, 2026

Question posted 2013 · +7 upvotes

I’m only posting this since I wasn’t able to find a solution anywhere. I finally figured it out. Kind of silly really.

When using the RunCode property within an Access Macro, I was trying to run a Sub from my global module. I was getting the error “The expression you entered has a function name that database can’t find.” I couldn’t figure out what the issue was. I followed the advice of everyone that posted on this issue, which was mostly the following:

  1. Use () at the end of the procedure name
  2. DO NOT use the “=” before the procedure name

Still didn’t work!

Accepted answer +15 upvotes

THEN I read the error message carefully. It mentions that it could not find the FUNCTION name. Apparently, the RunCode property specifically requires a “Function” not a Sub. So, I simply changed my Sub to Function and it worked fine!

Hope this helps.

Top access-vba Q&A (6)

+15 upvotes ranks this answer #2 out of 12 access-vba solutions on this site — top 17%.