So, I figure I have to put the function being called by the query in at a higher level, so I put it back into the module. But then I get this error message:
"You can't reference a property or method for a control unless the control has the focus."
And it's referring to the line:
If...
I have a query that calls a function to return a value for a Criteria, but the function is located in a form -- and the query doesn't recognize it immediately when I load the form.
I tried moving the function to a module, but then some of the code in the function calls a Combo box in the form...
I'm using MS Access 2007 and having difficulty with VBA returning a value from a function. Here's my code, in a module:
Option Compare Database
Global CriteriaStr As String
Function Get_Criteria() As String
Return CriteriaStr
End Function
---
I get a compile error: Expected: end of...