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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete records from a table using DAOs 1

Status
Not open for further replies.

kennetha

Programmer
Sep 10, 2003
105
MT
Hi all,

Is it possible to delete a series of records in a table by DAO by using a query...maybe SQL?
Example:
I want to delete invoice no 12 and all it's records from a table have more invoice numbers

Thanks
Kenneth Agius
 
Have a look at the Execute method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How are ya kennetha . . .

Example SQL method:
Code:
[blue]   Dim SQL As String
   
   SQL = "DELETE InvoiceNo " & _
         "FROM [b][i]tablename[/i][/b] " & _
         "WHERE (ClientID=" & Me!InvoiveNo4 & ");"
   DoCmd.RunSQL SQL[/blue]

Calvin.gif
See Ya! . . . . . .
 
TheAceMan1,

If the Invoice number is collected from an Edit box example txtinvoiceno who would you modify the SQL code

Thanks
Kenneth
 
kennetha . . .

Code:
[blue]   Dim SQL As String
   
   SQL = "DELETE InvoiceNo " & _
         "FROM tablename " & _
         "WHERE (InvoiceNo=" & [purple][b]Me!InvoiceNo[/b][/purple] & ");"
   DoCmd.RunSQL SQL[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top