Clearing form control values

  • Thread starter Thread starter ME
  • Start date Start date
M

ME

I have a form with several combo boxes and checkboxes that
feed an uderlying query. I know I can clear the controls
with ME!Control = NUll but I would like to add a CLEAR
SELECTION button that will reset ALL controls to NULL
without having to list out each control. Is this possible
and how. I appreciate any pointers.
 
The required code would be something along the lines of
Dim ctl As Control

For Each ctl In Me.Controls
Select Case Me.ControlType
Case acComboBox, acTextBox, etc
ctl.Value = Null
End Select
Next

The case is important as you are unlikely to want to clear
all controls. Also, not every control type has a Value
property. You will need to check against the Access Help
file as to which values you need to include in the Case clause

Hoe This Helps
Gerald Stanley MCSD
 
Back
Top