G
Guest
I have a Clear button that cycles through all controls in a form and fills
them with null values. The code for that is:
Dim ctl As Access.Control
For Each ctl In Me.Controls
If ((ctl.ControlType = acTextBox) Or (ctl.ControlType = acComboBox)
Or (ctl.ControlType = acCheckBox)) Then
ctl.Value = Null
End If
Next ctl
However, there are a few fields that have a control source linked to a combo
box, and when the code gets to these boxes I get an error: cannot assign a
value to this control. Understandable, since each field is supposed to be
equal to a column from the associated combo box.
I tried to add an exception to the If statement, but I can't figure out what
the property is for checking to see if a control has a control source.
(pseudocode: If ctl.controlsource = null then assign null value)
Thanks in advance!
Nick
them with null values. The code for that is:
Dim ctl As Access.Control
For Each ctl In Me.Controls
If ((ctl.ControlType = acTextBox) Or (ctl.ControlType = acComboBox)
Or (ctl.ControlType = acCheckBox)) Then
ctl.Value = Null
End If
Next ctl
However, there are a few fields that have a control source linked to a combo
box, and when the code gets to these boxes I get an error: cannot assign a
value to this control. Understandable, since each field is supposed to be
equal to a column from the associated combo box.
I tried to add an exception to the If statement, but I can't figure out what
the property is for checking to see if a control has a control source.
(pseudocode: If ctl.controlsource = null then assign null value)
Thanks in advance!
Nick