Can anyone explain to me why, in VBA code for a button on a form in MS-Access 2007, this gives the error "Compile error: Type mismatch: array or user-defined type expected"
Private Sub Button_Click()
Dim Arr() As Integer
Foo (Arr())
End Sub
Private Sub Foo(Arr() As Integer)
Me.Field.Value = "Foo"
End Sub
but this compiles fine?
Private Sub Button_Click()
Dim Dummy
Dim Arr() As Integer
Dummy = Bar (Arr())
End Sub
Private Function Bar(Arr() As Integer)
Me.Field.Value = "Bar"
End Function
The function/subroutine I'm writing doesn't return anything, but I can't get it to compile unless I assign the return value of my function call to a dummy variable, like in the Bar function above.