By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 802 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Using SQL in to Delete a Record in Database Table

P: 32
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
Share this Question
Share on Google+
4 Replies


100+
P: 1,646
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

P: 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

P: 32
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

100+
P: 1,646
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

Post your reply

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