1.

Solve : VBA (Access) making functions available accross forms?

Answer»

Hiya,

Need to code a solution in VBA for some schoolwork.
I have several forms with a fair amount of code on each.

I've written functions to GET DATA I need from the tables via recordsets, but I was hoping to define them once somewhere and call them throughout the Access database. Is there any way of doing this? I've checked with my teacher, but as usual with just about.. anything - he doesn't have a clue.

Thanks in ADVANCE,
JamesSorry to double post, but I found the solution.
Literally just make a new module (INSERT>Module), name it and paste the code in their.
Provided that you don't try to define a function with the same name somewhere else, it seems to just work.Sometimes it helps to just talk about something.
This is about making a user defined thing global.
http://support.microsoft.com/kb/151490
Quote

By default, a user-defined function is limited in scope to the workbook in which the function resides. In other words, only sheets within the same workbook can call a user-defined function. If you want to call a user- defined function from another workbook, you must first make a reference to the workbook that contains the user-defined function.


Discussion

No Comment Found