Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jul 2006
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto deletion of data in tables (2003)

    Is there any way a user can delete data in some tables by means of a macro or query rather than go into the table all the time and delete the records.

    Any help would be appreciated.

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

    Re: Auto deletion of data in tables (2003)

    Yes there are lots of ways.

    There is a category of queries called delete queries. Create a query in design view, slecet the table, then choose Query...Delete Query from the menus, Add the * to represent all fields and you have a query that will delete all records from the table. Often you only want to delete some records, so you would then set criteria to say which records you want to delete. A delete query is an example of an action query. It does something to your data rather than just returning some records.

    To execute the query you can double click it in the database window, or create a macro with the action "open query" then specify your delete query as the one to open.
    Regards
    John



  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: Auto deletion of data in tables (2003)

    If you want to delete just one record at a time you can create a macro that will delete the current record.

    Create a macro and choose RunCommand as the Action, then DeleteRecord as the command. If you attached this macro to a command button it would delete the current record.
    Regards
    John



  4. #4
    4 Star Lounger
    Join Date
    Jul 2006
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto deletion of data in tables (2003)

    Thats great thanks for that.

Posting Permissions

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