Results 1 to 4 of 4
  1. #1
    justinwright is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    104

    Delete empty entires

    I was wondering if there was a way in VB code to search for and delete empty entires (in case someone hits the Add Record button I made by mistake without putting anything in). The test would be if the SITE section (normally a number thats 3 - 6 digits) in the List table is filled in. If not, clear the entry (row).



    I saw a post here:
    https://www.accessforums.net/program...able-5608.html

    But it's for columns, not rows.

    I'm putting it as a button on an administration form.

    Any help is much appreciated .

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Try a delete query:

    DELETE * FROM TableName WHERE Site Is Null

    If you want to do it from code:

    CurrentDb.Execute "DELETE * FROM TableName WHERE Site Is Null", dbFailOnError
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    justinwright is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    104
    Worked perfectly, thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No problemo, glad it worked for you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Delete Field if Empty?
    By bpowers2010 in forum Reports
    Replies: 1
    Last Post: 07-10-2010, 12:04 AM
  2. empty field
    By amber mara in forum Access
    Replies: 2
    Last Post: 05-05-2010, 01:46 PM
  3. Getting Rid of Empty Space
    By Pam Buckner in forum Database Design
    Replies: 5
    Last Post: 03-05-2010, 05:46 PM
  4. Go to first empty record
    By westcoastbmx in forum Forms
    Replies: 2
    Last Post: 10-30-2009, 01:37 PM
  5. Empty Lookup
    By mikel in forum Access
    Replies: 39
    Last Post: 08-07-2009, 01:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums