Full Version: Prompt "clear form" for Data Entry
UtterAccess Forums > Microsoft® Access > Access Forms
Krampus
I have created a form that is used for data entry for employee timecards. I also made a "Save" button that would save all the values inputed to the table... but I am using a "single view" form, and would like the save button (after saving the data to the table) also clear the data on the form so that the data inputter can continue on with the employees instead of exiting out of the form after every timecard. Can anyone seem to help me out here?!
dvanced Thanks.
freakazeud
Hi,
You don't really need a save button! Access stores the data into the underlying source as soon as the record loses focus, unless you have an unbound form which I doubt.
To clear the controls on a form you could use some code like this:

Dim ctl As Control

On Error Resume Next
For Each ctl In Form.Controls
If ctl.ControlType = acTextBox Then ctl.Value = Null
Next ctl

HTH
Good luck
dannyseager
If the form is bound to the table then all you need to o is goto a new record
!--c1-->
CODE
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec

Whilst olivers code will clear all the data is the form is bound to a table then it will delete all the data from the current record which I'm guessing you dont want to do.
Krampus
Danny,
iller answer... 'twas so simple (that's why I tried it first), but did everything that I needed it to do (and more)!
Thanks!
dannyseager
you're welcome
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.