Deleting a record

R

Rick Cassani

Does anyone know the syntax for deleting a SQL record via MS Access?
I get an error if I do it like this:
cmd.CommandText = "DELETE * FROM HM00200 WHERE SOPNUMBE = '" &
List33.Column(2, updateCount) & "' AND SOPTYPE = " & List33.Column(4,
updateCount)
Set rst = cmd.Execute
 
M

Michel Walsh

Hi,


A delete query does not return record.


xnn.Execute "DELETE * FROM HM00200 WHERE SOPNUMBE = '" &
List33.Column(2, updateCount) & "' AND SOPTYPE = " & List33.Column(4,
updateCount)



should do.



Hoping it may help,
Vanderghast, Access MVP
 
R

Rick Cassani

I get an error on the xnn.Execute statement. "Compile Error. Invalid use of
Property".
 
M

Michel Walsh

Hi,


What do you get if you debug-stop at that line and, in the immediate
window, then, when the code is waiting-stop at that line, type:

? List33.Column(4, updateCount)


What string do you get with (one line), or do you get the same error,
and no result:

? "DELETE * FROM HM00200 WHERE SOPNUMBE = '" &
List33.Column(2, updateCount) & "' AND SOPTYPE = " & List33.Column(4,
updateCount)



and if you get a result, if you cut and paste that result you get, in the
previous manipulation, into the SQL view of the query designer, is there an
error running that SQL statement, when switching into data view,or when
running (exclamation point) it?



Hoping it may help,
Vanderghast, Access MVP
 
Top