I have a VBA function that returns Boolean (true/false) based on the one parameter that is entered into it. I have attempted to plug this function into a validation rule on an Access form.
Validation Rule:
MyFunction ([My Field])
MyFunction in VBA:
Public Function MyFunction(str as String) as Boolean
MyFunction=Len(str)>4 'Just as an example, the actual function is a bit more complex, but still returns true when expected and false when expected. This has been observed when stepping through the actual VBA code
End Function
I can see in VBA that the function actually does get called, and that it returns true and false as expected, but for some reason, regardless of what the function actually returns, Access is still seeing the value of [My Field] as invalid (note: [My Field] is a text field with no input mask).
So, what must I do to get the 'True' value that is returned by my VBA function to register as valid in my validation rule?
I'm using Access 2010.