Never mind. I see that your call in autoexec appears correct.
Maybe you did what I did... Here's my code:
(Yep, it's really simple code on purpose)
I tried calling it like 5 times like this in the macro:Code:Public Function GetTodaysDate() As Date GetTodaysDate = Date End Function Public Function HelloToday() MsgBox "Today's date is " & Format(GetTodaysDate(), "MMM-DD-YYYY"), vbOKOnly End Function
Function Name: HelloToday
which is wrong. =) it should be
Function Name: HelloToday() <--- note the parentheses.
(it makes sense, though. "HelloToday" without the () would be interpreted as being a Sub and not a Function. Putting () at the end basically indicates "this is a function that I'm calling".
I was getting some weird not helpful error, but once you put the parentheses in at the end, it works a champ. Lesson learned!
Thanks, Bill.
Not quite sure how your example changes things relative to my OP, as you can see from the screenshots, I include the parentheses both in the Function and the AutoExec.
Okay, super weird. Your code looks right... no idea why it's not working.
At this point, I'd import at least that function into a new database and see if you can get the macro to work. That's really odd. it's a bit of a reach, but what happens if you try to compile your VBA code?
while on VBA, Debug and compile your code, maybe there are some errors?
Super weird is right! I created a new DB, copied the macro and general module from the failing DB to the new DB and ran the new DB without any problems. So, what's seen the screenshots in the OP works just fine.