473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Delete sql confirm

stephane
how to cancel default and make own confirm message showing during when execute delete sql query?

ive got such code
Expand|Select|Wrap|Line Numbers
  1.     SQL1 = "DELETE FROM Clients WHERE contact=" & [contact]
  2.     SQL2 = "DELETE FROM Contacts WHERE id=" & [contact]
  3.  
  4.     DoCmd.RunSQL SQL1
  5.     DoCmd.RunSQL SQL2
  6.  
so user must confirm delete two times
Feb 13 '07 #1
2 3613
ADezii
8,834 Expert 8TB
how to cancel default and make own confirm message showing during when execute delete sql query?

ive got such code
Expand|Select|Wrap|Line Numbers
  1.     SQL1 = "DELETE FROM Clients WHERE contact=" & [contact]
  2.     SQL2 = "DELETE FROM Contacts WHERE id=" & [contact]
  3.  
  4.     DoCmd.RunSQL SQL1
  5.     DoCmd.RunSQL SQL2
  6.  
so user must confirm delete two times
Here is 1/2 of the puzzle - let me know if you need help with the other 1/2:
Expand|Select|Wrap|Line Numbers
  1. Dim MySQL As String, Msg As String, Response As Integer
  2. Msg = "Delete ALL Records from YourTableName"
  3.  
  4. Response = MsgBox(Msg, vbQuestion + vbYesNo + vbDefaultButton1, "Deletion Prompt")
  5. If Response = vbYes Then
  6.    'Turn OFF Delete Notification
  7.    DoCmd.SetWarnings False
  8.  
  9.    MySQL = "DELETE * FROM YourTableName;"
  10.    DoCmd.RunSQL MySQL
  11.  
  12.    'Custom Confirmation
  13.    MsgBox "All Records have been DELETED from tblYourTableName", vbExclamation, "Delete Confirmation"
  14.  
  15.    'Turn ON the display of System Messages
  16.    DoCmd.SetWarnings True
  17. Else    'User changed his/her mind
  18. End If
Feb 13 '07 #2
thenks)
no more questions)
Feb 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Richard Payne | last post by:
I am developing a web application that utilises multiple grids, panels, validation controls etc on the same page. I have added the appropriate code to pop up dialogs to confirm delete in...
2
by: Hans | last post by:
Hi! I have an asp application where I use a lot of javascript for validations etc and as it is today I use alert, confirm and prompt dialogs. Now we are adding support for unicode and I have...
3
by: John Galt | last post by:
I am trying to stop the Delete confirm message from showing up on a delete of all records in a table. The code (THAT IS NOT WORKING) is: Me.BeforeDelConfirm = "Form_BeforeDelConfirm"...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
4
by: tfsmag | last post by:
Okay, I have a project management app i'm writing and in the left hand menu i have a treeview control that is populated with each project... in child nodes under each project node I have an "edit"...
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
0
by: azbehzad | last post by:
Dear Guys, I have a problem with putting delete confirm in my code I add this code in Gridview_RowDataBound() event protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)...
0
by: johnmott | last post by:
Hi all, One of the limitations of the GridView control is that the built-in delete processing doesn't prompt for confirmation -- something thats very important for a user interface. True, you...
3
by: brucedodds | last post by:
My application has a form based on a parent table with a subform based on a child table. The relationship is Cascade Delete. The first record displayed when the form opens has five child records....
1
by: anish5000 | last post by:
Hi, I have a page abc.jsp...(the page includes strut2 tags s: ) <s:url id="delete" action="delete" > <s:param name="proj.id" value="id" /> </s:url> <s:a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...

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.