Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2012
    Posts
    78
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Delete the Field contents in Access 2010 using VBA Code

    Hi

    I have a table named "Items" with several fields. I want to delete the contents of two fields but retain the column headings. The two fields are named "OnHand" and "Dates". I was thinking of a form with a button that would execute the code. Is this possible?

    J

  2. #2
    Administrator
    Join Date
    Jun 2010
    Location
    Portugal
    Posts
    12,519
    Thanks
    152
    Thanked 1,398 Times in 1,221 Posts
    Some examples of running SQL from ADO: http://oakdome.com/programming/MSAccess_Using_ADO.php.

    In your case, you'd need to run an UPDATE query, setting the column values to NULL or an empty string (if they are of a text type).

  3. #3
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Redditch, Worcestershire, England
    Posts
    233
    Thanks
    0
    Thanked 22 Times in 21 Posts
    Also if you think this is something you want to do on an ad hoc basis you can set up an update query through the user interface. This can either be executed directly, by yourself, or executed via VBA from a command button if you're setting something up for other users and want to protect them from the details.

Posting Permissions

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