delete with dlookup

  • Thread starter Thread starter peljo via AccessMonster.com
  • Start date Start date
P

peljo via AccessMonster.com

I have a form with not updatable controls. Can i however delete rows in the
table referring to the control clicked on the form ? For example, in my form
i have a productid = 76. Could i clicking this control delete the productid
= 76 from the table products1 ?
 
Yes, you can execute a delete query.

Dim strSQL As String
strSQL = "DELETE FROM products1 WHERE productid = " & Me.txtProductID &
";"
CurrentDb.Execute(strSQL), dbFailOnError
Me.Requery

The requery is necessary because it was in your recordset, but no longer is.
 
thank you so much ! it works !
Yes, you can execute a delete query.

Dim strSQL As String
strSQL = "DELETE FROM products1 WHERE productid = " & Me.txtProductID &
";"
CurrentDb.Execute(strSQL), dbFailOnError
Me.Requery

The requery is necessary because it was in your recordset, but no longer is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

error in code 3
addition with 0 1
updating 1
delete query 1
DCount 3
getting certain fields from a particular record 3
Access Control on subform / combo box requesting parameter 0
Update query 3

Back
Top