C
chanu
I want to clear the values in all the controls on my subform. I searched on
the net and found code for that.It is working well but i can't understand how
it works at some point in the IF clause in the SELECT CASE statement.Because
if the control is tested true against an empty string, the control value is
filled with null value. But after i enter a value in a control and click
cmdCLEAR how is it filled with null value though it is not an empty string.
Private Sub cmdCancel_Click()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
If ctl.ControlSource = "" Then
ctl.Value = Null
End If
Case Else
End Select
Next ctl
'I have added the following line to suit my purpose
Me.cboNameAllowance.SetFocus
End Sub
please teach me clearly, friends
the net and found code for that.It is working well but i can't understand how
it works at some point in the IF clause in the SELECT CASE statement.Because
if the control is tested true against an empty string, the control value is
filled with null value. But after i enter a value in a control and click
cmdCLEAR how is it filled with null value though it is not an empty string.
Private Sub cmdCancel_Click()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
If ctl.ControlSource = "" Then
ctl.Value = Null
End If
Case Else
End Select
Next ctl
'I have added the following line to suit my purpose
Me.cboNameAllowance.SetFocus
End Sub
please teach me clearly, friends