deleting a table record from a form
deleting a table record from a form
(OP)
I have a continious form, based on a table (fd_inspector) - showing 2 fields "food inspector" and "delete" which is a yes/no field.
There is a command button "close" which when pressed I'd like the record in the table "food inspector" to be deleted, ONLY WHERE the "delete" field has been ticked (i.e. = yes)
I want to do this NOT using a query, so the user would have to click OK to confirm "data will be modified in the table (fd_inspector), I just want the user to tick, close and thats it! that food_inspector is deleted
Regards
Gwilym
There is a command button "close" which when pressed I'd like the record in the table "food inspector" to be deleted, ONLY WHERE the "delete" field has been ticked (i.e. = yes)
I want to do this NOT using a query, so the user would have to click OK to confirm "data will be modified in the table (fd_inspector), I just want the user to tick, close and thats it! that food_inspector is deleted
Regards
Gwilym
RE: deleting a table record from a form
dim rec as recordset
set rec = currentdb.openrecordset("fd_inspector", dbopendynaset)
do while not rec.eof
if rec!delete then
rec.delete
end if
rec.movenext
loop
rec.close
set rec = nothing
or you could use a delete query and disable the confirmation warnings given to the user:
DoCmd.SetWarnings False
DoCmd.OpenQuery "delete_records", acNormal, acEdit
DoCmd.SetWarnings True
Mike Rohde
rohdem@marshallengines.com
RE: deleting a table record from a form
codeDB.Execute "DELETE * FROM fd_inspector WHERE delete"
My e-mail is: vzudaire@yahoo.com