"Clear" Button

  • Thread starter Thread starter Bill Case
  • Start date Start date
B

Bill Case

How can I code a button to clear (erase) the selections
made in multiple combo boxes on the form?

Thank you very much.
 
If the combos are bound, that is, based on fields in the form's
recordssource, you can just put the following in the button proc:
Me.Undo
Me.Undo

If they are unbound you have to set each control to Null or a zero length
string ("").

Ragnar
 
Bill,

I assume this is for your search form and they are all
unbound. Try...

Dim ctl as Control

On Error Resume Next
' You will throw errors on labels and such, just ignore.

For Each ctl In Me.Controls
ctl.Value = Null
Next ctl

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Hi Ragnar . . .

Thanks for your advice. The boxes are unbound. Can you
kindly provide me with the code to set the fields to
null? I'm quite new to VB (as in, I know what I know
based on people giving me code!).
 
Back
Top