Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Delete record (2003)

    I've created a small database for our production department for recording problems. The Log no, is an autonumber. The problem is that a number of logs have been created, then not filled in, leaving loads of blank records in the database. I know that if you delete an Autonumber field, it will still create the next number. That's no problem. I just want to get rid of the blank records, as they show up on a report. Can a Macro be created to do this, or would an Update query do it better?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete record (2003)

    You can use a delete query. You need to specify a field that can be used to determine if a record is blank, i.e. if the field is blank, the record as a whole will be blank.
    - Create a new query based on the table.
    - Add the field to the query grid.
    - Enter Is Null in the Criteria line.
    - You can add other fields if you like
    - Switch to datasheet view to check that only blank records are returned.
    - Switch back to datasheet view.
    - Select Query | Delete Query.
    - Select Query | Run or click the Run button on the toolbar.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Delete record (2003)

    You need a delete query.

    Create a new query based on the relevant table. Select the * from the field list.
    Go to the Menus Query...Delete

    Now add the field that determines whether it is a blank record or not to the query grid, and on the criteria line put Null

    This query then says "delete all records from table tablename where field fieldname is NUll"

    Perhaps you might then create a macro that automates the running of the query.

    An update query just changes the values of records within a table. It does not add records or delete them.
    Regards
    John



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •