Shortcut to clearing a form?

stan-ee

New member
Local time
Yesterday, 21:45
Joined
Apr 16, 2012
Messages
8
I am organizing an old database that has some duplicate/redundant entries. Currently, when I find a redundant entry I manually hit delete in each text box to clear the form. I know you can just delete an entire entry but then I believe I lose the ability to reuse the particular serial number that is auto generated for that entry. Is there a shortcut to clearing all text from a form so I can still come back and reuse that serial number?
 
You could create a button on your form with some VBA code in the On Click event of the button that will do what you want to do.

Provided you are using a bound form (linked to a data source) and you have a text box on your form named "txtFirstName", the VBA code to clear that text box would be something like the following air code:

Code:
Me.txtFirstName = ""

That single line of code could be repeated to refer to every control on your form. Then you could simply click the button on the form and the code would be executed, clearing the controls on the form.

FYI, trying to use and AutoNumber type field is not a good idea when you are trying to have that also be a Serial Number or some other incrementing number. Be aware that although most of the time you see this number simple incremented by one, you cannot be assured or guaranteed that this will continue to be the case. The AutoNumber can be any number, even a negative number, as long as it is a unique value.

You should really have another field that is incremented using code so you can have control over when and how that value is incremented. (Just my thoughts.)
 
Yes, Pat, I am aware of the differences. I was only giving an example of how to accomplish what the OP indicated they wanted to do.

I do agree with you, as I think I indicated with the last part of my post, that this is not the correct approach to the problem, but the OP did ask how for a "shortcut to clearing a form".
 

Users who are viewing this thread

Back
Top Bottom