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

VBA delete record from table if certain fields are empty 1

Status
Not open for further replies.

SeadnaS

Programmer
May 30, 2011
214
Subject says it all really. Need VBA code to delete a record if certain fields are empty in the table.

My form keeps saving useless records with empty fields and I keep going into the table and deleting them manually. So maybe in the forms on close event i could put in some code to delete records with null values.
 

My form keeps saving useless records with empty fields
Here is your problem - fix your Form and you are set.

To get rid of 'useless records' try:
[tt]
DELETE FROM tblMyTable
WHERE SomeField = NULL
AND SomeOtherField = ' '[/tt]

Syntax depends on your definition of 'empty fields': NULL, Spaces, one space, empty string [tt]('')[/tt]?

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top