Forum Discussion
Regarding macros and function in Microsoft access
- timsDec 02, 2021Copper ContributorTry defining the function as 'Public' and see if it's then visible to the autoexec macro.
Public Function FetchData()
.....(stuff).....
End Function
https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/function-statement- isladogsDec 02, 2021MVP
For info, functions are always public unless specifically labelled as Private. The quote below is from the article that you linked
Also, the OP has already confirmed the function is Public
- Dec 02, 2021
Hi Colin,
I don't remember if we have already advised him to do a check inside VBA in order to see if the function is reachable at all:
1. Open the Immediate Window of VBA by pressing <Ctrl>+G anywhere in Access.
2. In the Immediate Window type the name of the function , i.e.
FetchData
and press <Enter> in this line
If the function executes, it is really public and should be reachable also for macros.
Servus
Karl
*********
Access-Entwickler-Konferenz: https://www.donkarl.com/?AEK
Access DevCon: http://AccessDevCon.com
Access FAQ (de/it): https://www.donkarl.com