Hi can someone tell me what I am doing wrong.
I am calling a function from within a form. The function is located in
module2.
The values pass to the function fine but the returned value from test2 is
alway 0.
Its probably a fundamental mistake but any help would be appreciated.
Option Compare Database
'Form
Option Explicit
Public Sub get_lib_num_Click()
Dim a, b, z As Integer
a = 5
b = 3
z = test2(a, b)
End Sub
'module2
Option Compare Database
Option Explicit
Public Function test2(ByVal x As Integer, ByVal y As Integer) As Integer
z = x + y
End Function
Duane Hookom - 04 Nov 2006 05:34 GMT
Try:
Public Sub get_lib_num_Click()
Dim a As Integer, b As Integer, z As Integer
a = 5
b = 3
z = test2(a, b)
End Sub
'module2
Option Compare Database
Option Explicit
Public Function test2(ByVal x As Integer, ByVal y As Integer) As Integer
test2 = x + y
End Function

Signature
Duane Hookom
MS Access MVP
> Hi can someone tell me what I am doing wrong.
> I am calling a function from within a form. The function is located in
[quoted text clipped - 21 lines]
>
> End Function