timhans
Programmer
- Jun 24, 2009
- 75
I cobbled together my first function two days ago(with help from the form)
Function ClearAll(c As String, f As Form)
Dim ctl As Control
For Each ctl In f.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
If ctl.ControlSource = "" And ctl.Tag <> "c" Then
ctl.Value = Null
End If
Case Else
End Select
Next ctl
End Function
then behind a button: ClearAll("c", Me.Form)
When I tried to use it I recivced an error msg: exspected = sign
and...... of course, functions return values, and non are being asked for so an error would be exspected
Next tried: Call ClearAll("c", Me.Form) and this works, so is the above a function or a public sub, and if its a public sub the above imply's that
call function = public sub ?.
In general: A function returns a value and a Public Sub exacutes a procedure, is this right ?. Any help in clearing up my confusion is appriciated
Function ClearAll(c As String, f As Form)
Dim ctl As Control
For Each ctl In f.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
If ctl.ControlSource = "" And ctl.Tag <> "c" Then
ctl.Value = Null
End If
Case Else
End Select
Next ctl
End Function
then behind a button: ClearAll("c", Me.Form)
When I tried to use it I recivced an error msg: exspected = sign
and...... of course, functions return values, and non are being asked for so an error would be exspected
Next tried: Call ClearAll("c", Me.Form) and this works, so is the above a function or a public sub, and if its a public sub the above imply's that
call function = public sub ?.
In general: A function returns a value and a Public Sub exacutes a procedure, is this right ?. Any help in clearing up my confusion is appriciated