Consulting

Results 1 to 2 of 2

Thread: A button to delete records using vba

  1. #1
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location

    A button to delete records using vba

    Hi, I would like to be able to delete records of my customers on a form that i developed by clicking on a button. Do you know of or have a sample of vba code i can use to do this operation?

    Thanks for your contributions!

  2. #2
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    257
    Location
    Instead of deleting the record, you may want to have a delete_flag field on the Customer table. Set this flag to "Y" to indicate this Customer has been deleted.

    Use the delete_flag value in any queries/forms and reports to account for deleted Customers.
    eg
    To Select active/current Customers:
     Select * from Customer where delete_flag <> "Y"
    To Delete a Customer:
    Use an Update query to set the delete_flag.
    UPDATE Customer SET delete_flag = "Y"
    WHERE Customer_ID = ...the value of Customer_ID based on your form
    air code --- not tested

Posting Permissions

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