469,623 Members | 1,422 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

How to delete all the records in a specific field using VBA

Dear experts,

I am a beginner of MS Access and seeking for help on how I could sort out the issue of deleting all records in a field by using a button with underlying VBA codes.

I have a table that I use as a subform... below is the subform table layout.

AddYesNo (this is a checkbox)

I also have a button that I renamed as 'Clear Selection'.

What I would like the code to do is that once I have pressed the 'Clear Selection' button, I would like the the specific fields...[AddYesNo], [ProjectID] and the [Quantity] to be able to clear all the data that I have historically captured leaving the three fields to be a null value.

Could this be possible using VBA?

Thank you in advance for your help.
Nov 27 '14 #1
2 937
3,653 Expert Mod 2GB
This is a strange request, but yes this is possible in VBA.

There are two primary ways to do this: One would be to create a recordset based on your table, and cycle through all records setting the field values as desired. The other would be to programmatically create a SQL statement for an update query and execute that SQL statement.

Both would work equally well, but it depends on what you are more comfortable with.
Dec 1 '14 #2
Thank you, Twinnyfo, I will give it a try. :-)
Dec 2 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by RICHARD BROMBERG | last post: by
6 posts views Thread by satish mullapudi | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.