|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBA: Custom function without parameter giving Expected = error
I have two functions, one with a parameter and one without eg: Code:
Public Sub FuncWParam(state as boolean)
'some code here
End Sub
Public Sub FuncWOParam()
'some code here
End Sub
Now I can call the function with a parameter like this: Code:
FuncWParam (1) but if i try calling the function that does not have a parameter i get an error Code:
FuncWOParam() error is: Expected: = so i tried giving the function a return value into a variable but then i get the error Expected: Function or Variable any ideas? PS. Another idea I had was, can i use a variables value in a statement? ie somthing similar to: Code:
Public Sub ClearObject(obj as string)
Me.obj.Value = Null
End Sub
thanks very much for any replies |
|
#2
|
|||
|
|||
|
try calling the sub procedure without the parentheses
Code:
FuncWOParam you don't use parentheses unless your 'function' returns a value. You are actually using 'sub procedures', not functions. |
|
#3
|
|||
|
|||
|
ok will call them that from now on.
any ideas on how i can use a parameter in a sub procedure directly in a command such as me.parameterhere.value = null (the sub procedure is one that clears the values of the form fields) |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > VBA: Custom function without parameter giving Expected = error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|