In Access 2007 I created the following function in a form:
Public Function CompanyChoice()
'Used to filter lstChoices rowsource on form
CompanyChoice = TempVars("Company")
End Function
When I first tried to use it I got a message something like Subroutine or
Function undefined.
So I decompiled and compacted the database. Now I get a message:
Run-Time error '9': Subscript out of range.
This is in the immediate window while the function is open.
I thought that the form may be the problem, so I created a new form to fun
the function with the same problem.
If I use the Function as the criteria of a query (which is what I need to
do) I get a message:
Undefined function 'CompanyChoice' in expression.
But this in the Click event of a button on a form:
MsgBox CompanyChoice()
Returns the correct value without a problem.
Thanks for any help and God Bless,
Mark A. Sam
"Klatuu" <Kla...@discussions.microsoft.com> wrote in message
news:6BB3C087-7AEE-4F5F...@microsoft.com...