Clear Button

dzeunen

Registered User.
Local time
Today, 06:40
Joined
Aug 3, 2017
Messages
10
I have been trying to add a button the will clear a record in the event that the wrong information is entered. My button gives me an error The Command or function "undo" isn't available now.

I have tried to Google the answer however, I don't understand the fixes. Can someone "dummy proof" it for me? I attached my form, it was created in Access 2007.

Thanks!
 

Attachments

Your db has 11 forms
For anyone to look at this for you, you first need to EXPLAIN which form & which button you are referring to
 
Yes, I am sorry. I have a lot of work to do on this form and I only logged into Access for the first time yesterday. It is MUCH more difficult than I expected however, I am trying to dazzle the Chief with an awesome form. Probably not one of my better ideas.:rolleyes:

I would like the end-user to be able to "Clear" each form using a button. With that said, I want all the forms to have a clear button. Is that possible?

My guess is that they will start typing in wrong information and want to delete it and start over.

Thanks for the reply!!!
 
I found a code that works to clear the detail but it comes back when I reopen the form even after I save it. Any advise?

Option Compare Database
Private Sub clear_Click()
On Error GoTo Err_clear_Click
DoCmd.GoToRecord , , acNewRec
Exit_Clear_Click:
Exit Sub
Err_clear_Click:
MsgBox Err.Description
Resume Exit_Clear_Click
End Sub

Thank you
 
Yeah, starting with forms is a poor idea. You have some major issues with your database. If you plan on using this as a database (and not a glorified spreadsheet which it is now), I suggest you read up on normalization (https://en.wikipedia.org/wiki/Database_normalization). That's the process of properly structuring your tables.

What's the purpose of this database? What do you hope to get out of it? I mean that figuratively and literally--I see no reports, how is your data to come out of this thing? Are you even certain you can get the data out like you want? I suggest you put your forms on hold and develop this thing properly if its going to be more than a form front end for a bunch of spreadsheets.
 
The VBA code you posted takes you to a new record (new row in table) BUT it doesn't delete the existing record.

Your existing code on the form I looked at uses embedded macros.
I never use these so I can't help you.

The advice I would give you is to instead do event procedure code using VBA

There are lots of different ways of deleting a record using code.
Googling this forum will give you lots of advice.

Good luck with your project
 
Your 'Clear' button is in the Header of your Form, and when you click on it, you have left the Record, and in Access, when you leave a Record, the Record is automatically Saved. Since the Record has been Saved, it cannot be undone!

You need to place the Clear button onto the Detail Section of the Form..

Linq ;0)>
 
Thank you for all of your reply's. My ultimate goal was to count the tasks that each individual Officer performed daily, weekly, or annually. In addition, it was important that the form could be easily reviewed by the Captain as to what daily occurrences took place for that shift.

It's obvious from all of your comments that my lack of experience outweighs my determination. With that said, I think I will tuck my tail between my legs and tell the Chief "I just can't do it".

Thanks again, it really has been fun!!!

Sincerely,
Diana
 
Sadly, Microsoft has perpetuated the myth that 'anyone can build a database,' using Access, and that's probably true, if you want to run up an address/phone number database, or one to keep track of your personal expenditures, but for something like you're attempting you really need to take the time to learn not only the basics, but some of the more advances techniques, as well. It's certainly not something a total newbie can jump into and knock off in a week!

Linq ;0)>
 
Not sure if this will help for your form, but, my clear button consists of this code:

Code:
Private Sub Command46_Click()

Me.Initials = ""
Me.JobNumber = ""
Me.ItemNumber = ""
Me.DiNumber = ""
Me.PieceCtn = ""
Me.CartonPlt = ""
Me.LooseQty = ""
Me.LoadNumber = ""
Me.PieceWeight = ""
Me.PieceLength = ""
Me.PieceWidth = ""
Me.PieceHeight = ""
Me.CartonWeight = ""
Me.CtnLength = ""
Me.CtnWidth = ""
Me.CtnHeight = ""

End Sub
 

Users who are viewing this thread

Back
Top Bottom