help with Undo please

  • Thread starter Thread starter Shadow
  • Start date Start date
S

Shadow

How can I reset a form?

The form is an unbound form and the users inputs some values or selects some
options to search tblOrder table. I need when the user click a button, all
the textboxes, frames and everything else goes back to their default values.

"Me.Undo" doesn't work out. Maybe because the form is unbound.


any kind of help is much appreciate.



thanks in advance
 
Hi,

Yes, Me.Undo will not work on an unbound form.
Too bad there is no Me.Unbound.Undo.
;-)

I did a little experimenting and this code 'seemed' to
work OK in my quick test on Access 97:

Private Sub cmdClearForm_Click()
On Error Resume Next
Dim ctl As Control
For Each ctl In Me.Controls
ctl.Value = ctl.DefaultValue
Next ctl
End Sub

It looked like it worked on text boxes, combo boxes,
option groups, and even list boxes. I didn't completely
test, so PLEASE check everything carefully.

I hope that helps,
Jeff Conrad
Bend, Oregon
 
thanks for the time you spent on this.
It's works perfect.

thanks a million.


shadow




Hi,

Yes, Me.Undo will not work on an unbound form.
Too bad there is no Me.Unbound.Undo.
;-)

I did a little experimenting and this code 'seemed' to
work OK in my quick test on Access 97:

Private Sub cmdClearForm_Click()
On Error Resume Next
Dim ctl As Control
For Each ctl In Me.Controls
ctl.Value = ctl.DefaultValue
Next ctl
End Sub

It looked like it worked on text boxes, combo boxes,
option groups, and even list boxes. I didn't completely
test, so PLEASE check everything carefully.

I hope that helps,
Jeff Conrad
Bend, Oregon
 
Back
Top