473,387 Members | 1,398 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.

Unable to delete a listbox entry using Command button on Access form

Hi,

I am unable to delete a selected record on listbox using command button.
I am new to Access and have made VB code using internet help.
Here is my code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Delete_Selected_Click()
  2.             Dim SQL11 As String
  3.             DoCmd.SetWarnings False
  4.             SQL11 = " Delete *" & _
  5.             " from dbo_Employee_Project" & _
  6.             " where [dbo_Employee_Project].[Project_ID] ='" & Me.List114.Column(0) & "' AND [dbo_Employee_Project].[Employee_Id] ='" & Me.Text50 & "'"
  7.             MsgBox SQL11
  8.             DoCmd.RunSQL SQL11
  9.             Me.List114.Requery
  10.              Me.Requery
  11.             DoCmd.SetWarnings True
  12.  
  13.  
  14. Exit Sub
  15.  
  16.  
  17. End Sub
When I click on Command button I get run-time error 3086, Could not delete from specified tables.

Thanks in advance for your help.

Anand
Jan 28 '16 #1
2 1173
Seth Schrock
2,965 Expert 2GB
Please post what is in your message box from line 7.
Jan 29 '16 #2
zmbd
5,501 Expert Mod 4TB
Per Seth, we do need that resolved string.

Please change the MsgBox on Line7 to:
Expand|Select|Wrap|Line Numbers
  1. Debug.Print SQL11
Run your code
Open the VBA Editor
<ctrl><G>

This will open the immediate window; therein, you should see the resolved SQL11 string.

Cut and paste that into a post within this thread
Please format the string using the [CODE/] formatting tool.
Feb 6 '16 #3

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

Similar topics

9
by: rdade22 | last post by:
Hi, I'm new so try to bare with me. I'm using access 2000 and I created a database where the user is prompted to click on a command button and the info that was put on the form is sent to a table....
4
by: sirimanna | last post by:
hi, Is any one can help me to open files in my computer(for an example: some word document)using command button... i want to open file's using my vb programme..but i can't do it...can any one...
7
by: Bre035 | last post by:
Created a database that I want to be maintained and updated by the Department designated Admins. I have an user table that set specific individuals access to Admin and created admin form and...
0
by: Paul Wilson | last post by:
Access 2003 Sp2 – Pretty new to Access so please bear with me! I have created a simple database which has 4 tables with matching column names but info from different systems. I have merged some...
4
beacon
by: beacon | last post by:
Hi everybody, I have a main form, frmDeficiency, that has a tab control, deficiencyTabControl, that has a subform, fsubEpisodeDetail, on page 2 of the tab control. I also have a command button...
19
by: aswgawlag | last post by:
Hello everyone. I am new to Microsoft Access and have been creating a database to store records, add new records, update records, delete records, search records, create reports from records, etc....
2
by: Jennytranxxx | last post by:
How do I assign a delete query onto a command button? I have read a few forums and it has told me to: Go to Properties Rename the Name and Caption, so i've renamed it to Runquery Under Event -...
1
by: Palaniappan | last post by:
how to add an item into the textbox by using command button in ms access in the form from the table?
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:
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?
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
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,...

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.