Delete not working

  • Thread starter Thread starter Bandit
  • Start date Start date
B

Bandit

Hi,
Can anyone see why this code isn't working? It is
similiar to the code that I use to add a record without
any problem. Thanks,,,

'-- Grab the first column
strQuestion = Me!lstReturnedQuestions.Column
(0, varQuestionsReturned)
'-- Set the other variables
strJob = Forms![CI-MI Questions]![cboJobs]
strArea = Forms![CI-MI Questions]![cboArea]
strCategory = Forms![CI-MI Questions]!
[cboCategory]

sql = "Delete from qryBOM_CIMI where
(JobNumber = '" & strJob & "' AND QuestionID = '" &
strQuestion & "' AND Area = '" & strArea & "' AND Category
= '" & strCategory & "');"

DoCmd.RunSQL sql
 
Have you opened the query qryBOM_CIMI and verified that a record exists in
the query that matches the criteria? You are using single quotes around the
criteria. Do any of the criteria strings have apostrophes in them? Do you
have a table relationship enforcing referential integrity that won't let you
delete a record that has related data in another table?

Do you get any error messages or does it just not delete the record? Have
you tried creating the query in the query design grid and trying it from
there?
 
Another possibility, if you open qryBOM_CIMI, can you manually delete a
record from the query by using the delete button on the toolbar?
 
Back
Top