hi Richard,
On 06.03.2010 17:15, Richard wrote:
> Where txtRef is a text box value entered by users
>
> So I created a public procedure
>
> Public Sub TestRef (ByVal FormName as Form)
> If FormName!txtRef = "" Then
> Exit Sub
> End If
> End sub
This makes no sense as the Exit Sub only affects the TestRef method, not
the calling one.
> Then from my form frmTest I created an on click event: Call TestRef(frmTest)
> I receive a 424 execution error, Object required.
You cannot pass an object as ByVal and the name of your variable is also
not well choose. This should work:
Public Function TestReference(ByRef AForm As Access.Form) As Boolean
TestReference = (AForm.Controls("txtRef") <> vbNullString)
End Function
mfG
--> stefan <--
|