Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete record in VBA (Win XP Access 2003)

    What it the method to use to delete a record in VBA?

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

    Re: Delete record in VBA (Win XP Access 2003)

    There are several possibilities:
    <UL><LI>If you want to delete the current record in a form:

    RunCommand acCmdDeleteRecord

    <LI>If you want to delete a record in any table, you need to specify which record. Examples:

    DoCmd.RunSQL "DELETE * FROM [tblSomething] WHERE [ID] = 37"

    or

    CurrentDb.Execute "DELETE * FROM [tblSomething] WHERE [ID] = 37"

    will delete the record(s) for which ID = 37 from the table tblSomething

    <LI>Both the DAO and ADO Recordset objects have a Delete method.[/list]The most appropriate method depends on the situation.

  3. #3
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete record in VBA (Win XP Access 2003)

    Perfect. Thank you.

Posting Permissions

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