How to remove an empty record from a table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm new to VBA. I have a table with a couple of blank records in it amongst
other full records. I would like to know what code I can use to delete these
records. I tried ...

DoCmd.RunSQL "DELETE * FROM tblNewPImodems WHERE TRACK_NO = """";"

but it doesn't work. Any help would be appreciated.
 
DoCmd.RunSQL "DELETE * FROM tblNewPImodems WHERE TRACK_NO = """";"

Assuming you want to find Null values of TRACK_NO then, this will work:

jetSQL = "DELETE FROM tblNewPImodems " & _
"WHERE TRACK_NO IS NULL;"

CurrentDB().Execute jetSQL, dbFailOnError


Note that using the DAO method also avoids the annoying "Are You Sure"
message box for the user.

Hope that helps


Tim F
 
Back
Top