Delete all text in a Form?

kentendresen

Registered User.
Local time
Today, 18:49
Joined
Nov 13, 2002
Messages
49
Hi!

I have a Form with some textboxes and a Option Group. Is it possible to make a button that blanks out all the boxes, if the user wants to start over on that post?
 
You could place a command button on the form without the wizard. Then on OnClick event, you can put the code:

Code:
Me.FieldName1.Value = Null
Me.FieldName2.Value = Null
Me.FieldName3.Value = Null
... etc etc
 
Docmd.Undo
 
Option Group

But what if I want to blank out the Option Boxes?

It doesn't work with '= Null' then...
 
You could try
Make a button called cmdClaerAll and use

Private Sub cmdclearall_Click()
Dim c As Control
' Enumerate Controls collection.
For Each c In Me.Controls
Select Case c.ControlType
Case acTextBox
c.Value = Null
Case acOptionGroup
c.Value = 0
End Select
Next c

End Sub

Think that works ...
Steve
 
Me.Undo backs out all changes to the form. Me.SomeField.Undo backs out changes to a specific field.
 
Steve, I tried your code, but the system comes back with an error message saying that it cannot apply a value to c.

Sonja
 
Pat,
me.undo works if the record is not saved yet, but how can you clear all controls when the record has already been saved?

Sonja
 
Pat...

Should I make a button with

Me.Undo

and

DoCmd.GoToRecord, , acNewRec

on the OnClick event?

I'm a rookie, so if you could tell me the whole code and where to put it, I would be very pleased.

BR,

Kent
 

Users who are viewing this thread

Back
Top Bottom