473,503 Members | 9,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete Query without the confimation prompts

I have form with a Close button. When the button is closed, I want it to
first delete all records in tblCustomerID then close the form.
I would like the delete query to just run and not prompt me over and over
and over to confirm because I WANT to DELETE them.
If it's better to run it as SQL code and not a separate query, that's cool,
but I have no idea how to do this.

Heres the code behind the OnClick event:

Private Sub cmdCloseForm_Click()
On Error GoTo Err_cmdCloseForm_Click

' This statement runs the query to delete all recordsfrom the
temporary table tblCustomerID

DoCmd.OpenQuery "qry_Lookup_DeleteCID"
DoCmd.Close

Exit_cmdCloseForm_Click:
Exit Sub

Err_cmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseForm_Click

End Sub
_______________________________________

Any help is deeply appreciated,

Presto
Jun 27 '08 #1
2 7331
On Sat, 12 Apr 2008 16:43:54 -0400, Presto wrote:
I have form with a Close button. When the button is closed, I want it to
first delete all records in tblCustomerID then close the form.
I would like the delete query to just run and not prompt me over and over
and over to confirm because I WANT to DELETE them.
If it's better to run it as SQL code and not a separate query, that's cool,
but I have no idea how to do this.

Heres the code behind the OnClick event:

Private Sub cmdCloseForm_Click()
On Error GoTo Err_cmdCloseForm_Click

' This statement runs the query to delete all recordsfrom the
temporary table tblCustomerID

DoCmd.OpenQuery "qry_Lookup_DeleteCID"
DoCmd.Close

Exit_cmdCloseForm_Click:
Exit Sub

Err_cmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseForm_Click

End Sub
_______________________________________

Any help is deeply appreciated,

Presto
Either....
Private Sub cmdCloseForm_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Lookup_DeleteCID"
DoCmd.SetWarnings True
DoCmd.Close
End Sub

or...

Private Sub cmdCloseForm_Click()
CurrrentDb.Execute "qry_Lookup_DeleteCID", dbFailOnError
DoCmd.Close
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Jun 27 '08 #2
Thank you Fredg! It works beautifully.
I just wish the Help that comes with Access would be a little more
intuitive.
In the VB editor I searched for this and it only showed the process to stop
ALL confirmations - which I don't want to do.
"fredg" <fg******@example.invalidwrote in message
news:1e*****************************@40tude.net...
On Sat, 12 Apr 2008 16:43:54 -0400, Presto wrote:
>I have form with a Close button. When the button is closed, I want it to
first delete all records in tblCustomerID then close the form.
I would like the delete query to just run and not prompt me over and over
and over to confirm because I WANT to DELETE them.
If it's better to run it as SQL code and not a separate query, that's
cool,
but I have no idea how to do this.

Heres the code behind the OnClick event:

Private Sub cmdCloseForm_Click()
On Error GoTo Err_cmdCloseForm_Click

' This statement runs the query to delete all recordsfrom the
temporary table tblCustomerID

DoCmd.OpenQuery "qry_Lookup_DeleteCID"
DoCmd.Close

Exit_cmdCloseForm_Click:
Exit Sub

Err_cmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseForm_Click

End Sub
_______________________________________

Any help is deeply appreciated,

Presto

Either....
Private Sub cmdCloseForm_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Lookup_DeleteCID"
DoCmd.SetWarnings True
DoCmd.Close
End Sub

or...

Private Sub cmdCloseForm_Click()
CurrrentDb.Execute "qry_Lookup_DeleteCID", dbFailOnError
DoCmd.Close
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
11185
by: Joe Del Medico | last post by:
I have two tables A & B and I want to delete all the records in A that are not in B. Can I do this in the query builder? It seems like a simple problem. I can easily find the records in A that...
5
2226
by: lis0122 | last post by:
I'm a database marketing manager for a small non-profit. I created a query that prompts you for a company name and then pulls a list of all of our contacts in the database in that company. Our...
2
1485
by: sparks | last post by:
I was running an update query and a make table query from a form to modify some data in a table. DoCmd.OpenQuery "qryrename" DoCmd.OpenQuery "qrymaketest" but this prompts you for everything....
1
1298
by: tom | last post by:
Is it possible to have a report with prompts/parameters, but without an underlying query? I've seen varying posts related to this, but I'm not seeing a concete answer. As I understand it, to make a...
13
2827
by: forbes | last post by:
Hi, I have a user that used the Query Wizard to create a query in Access. Now she claims that her master table is missing all the data that was excluded from the query. Can you create anything...
17
2033
by: (PeteCresswell) | last post by:
I've got apps where you *really* wouldn't want to delete certain items by accident, but the users just have to have a "Delete" button. My current strategies: Plan A:...
3
3794
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
5
4131
by: Bob Bridges | last post by:
Start with two tables, parent records in one and child records in the other, a one-to-many relationship. Create a select statement joining the two. Display the query in datasheet mode. When I...
11
12973
by: Neekos | last post by:
I have fields that autopopulate so that the user wont have to type in the same info over and over. The only problem with this is that the user can keep hitting new record because this info is...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.