How can I use a function with arguments in a query?
I’m trying to use a function w/arguments in a query;
“Select * FROM mytable Where myfield = ReturnMyVar() “ produces the following error.
Wrong number of arguments used with function in query expression
‘(((mytable.myfield) = ReturnMyVar()))’
The problem is that the ReturnMyVar function receives a variable from anther procedure in a Call Tree.
The rest of the story;
On the GotFocus event of a field called “Description,” I have the following procedure;
Public Sub Description_GotFocus()
myvar = Me.Description.Value
‘passes the value of myvar to the funtion ReturnMyVar()
Call ReturnMyVar(myvar)
End Sub
In the ReturnMyVar function I receive the variable as follows;
Public Function ReturnMyVar(myvar) As String
ReturnMyVar = myvar
End Function
This function has an argument and I think that is why I am getting the error message above.
Thank you,
Mabjro
I’m trying to use a function w/arguments in a query;
“Select * FROM mytable Where myfield = ReturnMyVar() “ produces the following error.
Wrong number of arguments used with function in query expression
‘(((mytable.myfield) = ReturnMyVar()))’
The problem is that the ReturnMyVar function receives a variable from anther procedure in a Call Tree.
The rest of the story;
On the GotFocus event of a field called “Description,” I have the following procedure;
Public Sub Description_GotFocus()
myvar = Me.Description.Value
‘passes the value of myvar to the funtion ReturnMyVar()
Call ReturnMyVar(myvar)
End Sub
In the ReturnMyVar function I receive the variable as follows;
Public Function ReturnMyVar(myvar) As String
ReturnMyVar = myvar
End Function
This function has an argument and I think that is why I am getting the error message above.
Thank you,
Mabjro