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

How can i delete records that i don't need throught form

Status
Not open for further replies.

miketamp

Technical User
Jan 28, 2005
20
GR
hi
i have a table called "tbl1" with 5 fields "one", "two", "three", "four", "five". the fields "one" and "two" are the primary key.the field "one" is autonumber and the field "two" is text.
Also i have a form called "form1". I want when i close the form1, the records that have all the fields empty exept the fieds "one" and "two" (which is the primary key) to be deleted automaticaly.
 
DoCmd.RunSQL "DELETE FROM tbl1 WHERE Trim(three & four & five & '')=''"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
thanx but i would like all this procedure to be hide. i don't want a confirmation message from access.i want the records to delete imediately.Can you please help me?
 
Private Sub Form_"your event here"(Cancel As Integer)
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM tbl1 WHERE Trim(three & four & five & '')=''"
DoCmd.SetWarnings True
End Sub

"My God! It's full of stars...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top