473,385 Members | 2,210 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,385 software developers and data experts.

Using SQL in to Delete a Record in Database Table

I am currently using Visual Basic 6 to write a Payroll Program.

I created a Database with one Table in Microsoft Access that ships with Office 2000. The name of the Database is "Payroll", and the name of the Table is "Emoluments".

I then usedcActiveX Data Control (ADO) to connect the Text Box controls on the Form to the Table. I have the following fields in the Table and the Form: Assessment Year, Tax Payer ID, Name, Address, Basic Salary, Other Allowances, Gross Pay, Tax Free Pay, Taxable Pay, Monthly Tax payable and Net Salary Payable.

I also have the following command buttons on the Form: Add, Delete, Save, and Close.

All the command buttons work perfectly with the exception of the Delete
button. Each time I run the program and click the Delete button I get the following error Message:
"Runtime Error - 2147217887(80040e21).
Multiple step operation generated errors. Check each status."

Please I want you to give me Sql statement that will delete any Tax Payer's record whenever the user wants to delete a record from the Table.

If I the user cannot delete a record from the Table my program will not be complete. In fact my program will be useless. Iam worried about this.

I eagerly wait for your help.

Akinyemi.
Dec 16 '06 #1
4 7344
willakawill
1,646 1GB
I am currently using Visual Basic 6 to write a Payroll Program.

I created a Database with one Table in Microsoft Access that ships with Office 2000. The name of the Database is "Payroll", and the name of the Table is "Emoluments".

I then usedcActiveX Data Control (ADO) to connect the Text Box controls on the Form to the Table. I have the following fields in the Table and the Form: Assessment Year, Tax Payer ID, Name, Address, Basic Salary, Other Allowances, Gross Pay, Tax Free Pay, Taxable Pay, Monthly Tax payable and Net Salary Payable.

I also have the following command buttons on the Form: Add, Delete, Save, and Close.

All the command buttons work perfectly with the exception of the Delete
button. Each time I run the program and click the Delete button I get the following error Message:
"Runtime Error - 2147217887(80040e21).
Multiple step operation generated errors. Check each status."

Please I want you to give me Sql statement that will delete any Tax Payer's record whenever the user wants to delete a record from the Table.

If I the user cannot delete a record from the Table my program will not be complete. In fact my program will be useless. Iam worried about this.

I eagerly wait for your help.

Akinyemi.
Hi would you please post the code for the click event of the delete button
Dec 16 '06 #2
Austen
23
Hi would you please post the code for the click event of the delete button
Please attach your code for troubleshoting
i think is logical error in delete button
Dec 16 '06 #3
Re: Using Sql to Delete a Record in Vb 6 Ms Access Database Table

Thank you for your interest in helping out. Here is my code that refuse to work:
Private Sub cmdDelete_Click()
Dim Sql As String
Dim intResponse As Integer

intResponse = MsgBox("Are you sure?", vbYesNo, "Delete query")
If intResponse = 6 Then
Sql = "Delete * From PAYE Where [Tax Payer ID]" _
= " & intTaxPayerId & "'"

End If
End Sub
Dec 21 '06 #4
willakawill
1,646 1GB
Re: Using Sql to Delete a Record in Vb 6 Ms Access Database Table

Thank you for your interest in helping out. Here is my code that refuse to work:
Private Sub cmdDelete_Click()
Dim Sql As String
Dim intResponse As Integer

intResponse = MsgBox("Are you sure?", vbYesNo, "Delete query")
If intResponse = 6 Then
Sql = "Delete * From PAYE Where [Tax Payer ID]" _
= " & intTaxPayerId & "'"

End If
End Sub
And what is that nasty text delimiter doing at the end of your query? :)
= " & intTaxPayerId & "'"

should be
Sql = "Delete From PAYE Where [Tax Payer ID] = " _
& intTaxPayerId
Dec 21 '06 #5

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

Similar topics

5
by: Andrew DeFaria | last post by:
I created the following .sql file to demonstrate a problem I'm having. According to the manual: If |ON DELETE CASCADE| is specified, and a row in the parent table is deleted, then InnoDB...
8
by: doomx | last post by:
I'm using SQL scripts to create and alter tables in my DB I want to know if it's possible to fill the description(like in the Create table UI) using these scripts. EX: CREATE TABLE(...
1
by: Prabhat | last post by:
Hi All, Sorry that I am Asking this question in this Group. I have one doubt in SQL Server, Regarding how DELETE Works? What is the Actual Thing that SQL Server Do when we delete any record...
2
by: R.Welz | last post by:
Hello. I want to discuss a problem I have with my database design becourse I feel I cannot decide wheather I am on the right way of doing things. First of all, I am writing a literature and...
3
by: bluez | last post by:
I want to design a webpage where user can search the data from the database and list out the related records. Each of the record got a delete button which allow user to delete the record. ...
1
by: Luqman | last post by:
I have created a form using single Table which has customerId and companyName field, using Typed Dataset. Now, if I click on Delete Button of Binding Navigator, the Customer Record is deleted...
2
by: =?Utf-8?B?QmV0bw==?= | last post by:
I am developing a ASP.NET application, with C# code-behind classes; with SQL Server 2000. All database access is made through stored procedures. I can insert, select and update in all tables...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
3
by: blakerrr | last post by:
Hi All, I have a strange situation that I can't figure out. The task is quite simple, delete a record from a table. Here is my situation: I have a form called Order Create which cycles through...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
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...

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.