472,125 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,125 software developers and data experts.

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 985
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.