P
Peter R. Fletcher
I have been trying, in the process of calculating the value of a
column in a query, to call a function which was (for good and
sufficient reasons) defined in VBA code in a Form Module in my
application. It was defined as Public in the Form Module, it was duly
accessible and worked (when the Form was open) if called from VBA
elsewhere in the application, and the Form was open (minimised) when I
was trying to design and run the Query.
The first problem was that the Build Wizard for the calculated column
did not find the Public Function as an attribute of the Form. The
second problem was that I could not, using any syntax I could think of
(Forms!frmMyForm.MyFunction(), Form_frmMyForm.MyFunction(), etc.)
entered manually, persuade the query, when run, to recognise the
function. Is this something that one cannot do, or am I simply being
stupid?
I have now developed an inelegant but effective workaround which does
what I was trying to do by handing off the Form data that the Function
uses (effectively an array of Keys) to code in a General Module and
then having the Query call it there, but I would really like to be
able to call a Function in a Form module.
column in a query, to call a function which was (for good and
sufficient reasons) defined in VBA code in a Form Module in my
application. It was defined as Public in the Form Module, it was duly
accessible and worked (when the Form was open) if called from VBA
elsewhere in the application, and the Form was open (minimised) when I
was trying to design and run the Query.
The first problem was that the Build Wizard for the calculated column
did not find the Public Function as an attribute of the Form. The
second problem was that I could not, using any syntax I could think of
(Forms!frmMyForm.MyFunction(), Form_frmMyForm.MyFunction(), etc.)
entered manually, persuade the query, when run, to recognise the
function. Is this something that one cannot do, or am I simply being
stupid?
I have now developed an inelegant but effective workaround which does
what I was trying to do by handing off the Form data that the Function
uses (effectively an array of Keys) to code in a General Module and
then having the Query call it there, but I would really like to be
able to call a Function in a Form module.