Button to delete all records of a table

F

Frank Situmorang

Hello,

Can anyone help me how can we make it just to pressed the button, then all
records in a table will be deleted/ purge out.

Background:

I want to distrtibute copy of my church database to all pastors of our
church. In my membership database, there is a child table of Notes...in which
a church clerck can put a note for the member. Before I give the copy of the
database to pastors, I want to purge out all the content of the table of
Notes, so that later I can collect it from them and inport their notes table
to be combined with the central database which is the one a scretary has. I
have made an append query for that.

Thanks for any help.

Frank
 
A

Arvin Meyer [MVP]

In the click event of the button try:

CurrentDb.Execute "Delete * From YourTableName;"
 
M

Mike Painter

I'd suggest adding a msgbox to ask if they really want to do this.

I wrote a billing program in MS BASIC many years ago and asked that
question.
Then she asked that I modify to to ask twice. (At which point she realized
I was right about demanding she back things up.)
Then she asked that I modify to to ask three times.
 
J

John W. Vinson

I'd suggest adding a msgbox to ask if they really want to do this.

I wrote a billing program in MS BASIC many years ago and asked that
question.
Then she asked that I modify to to ask twice. (At which point she realized
I was right about demanding she back things up.)
Then she asked that I modify to to ask three times.

"I have told you once,
I have told you twice -
What I tell you three times is true!"
- _The Hunting of the Snark_

And sometimes that's not enough. Sometimes the user is NOT right.
 
A

Arvin Meyer [MVP]

If MsgBox ("Are you really, really, REALLY sure?", vbYesNo) = vbYes Then
MsgBox "Say 'Please Delete' 4 times and click your heels twice",
vbOKOnly
End If
 
J

John W. Vinson

If MsgBox ("Are you really, really, REALLY sure?", vbYesNo) = vbYes Then
MsgBox "Say 'Please Delete' 4 times and click your heels twice",
vbOKOnly
End If

<chuckle>

I've actually used:

Dim strMsg As String
strMsg = "Clicking OK will permanently delete all the information about this
animal, and all the accounting information about it. This information CANNOT
BE RECOVERED. Are you absolutely certain that you want to do this?"

When the client saw the message she changed her mind about having the delete
button on the form...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top