New Access How to run VBA code that does not have Sub?


Please click here to see image

Hi, I'm new to Access and I have a quick question. I have a code that does not have 'sub'. And I was wondering how can I execute my code when I don't see any on Macro window? (Refer to the image attached)

My code start with function and declaration of variables!

It's very straight forward question but please comment below for any clarification if needed!

Thank you so much in advance and merry Christmas!

For you to be able to run a function with the press of a button for example, you must:

a) Put the function in a standard module, within the vba editor. Move the code to a new module and then call the function from a macro.


b) Run the function from within an event vba sub like the click of button.