Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL to detete multiple records.

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
US
There may be multiple line in the table that match the sql statement below. Can this code be changed to delete them all instead only one of do I have to open up a record set of the table and put some kind of Do/Loop in ?

SQLStmnt = "delete FROM tbl1 WHERE [File] = '" & strRef & _
"' AND Inv = '" & strInv & "' AND Field2 = '" & strField2 & _
"' AND LineNum = " & strLine
CurrentProject.Connection.Execute SQLStmnt
 
ALL the rows matching the WHERE clause should be deleted.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Since the SQL statement is filled with AND clauses when you say that there may be multiple lines that match theSQL statement do you mean matching what you ahve typed as the SQL statement? If so that will take care of all the row's in the table.

Lamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top