473,322 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 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.

ProductID
Category
Type
Description
ListPrice
Currency
AddYesNo (this is a checkbox)
ProjectID
Quantity

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 1042
twinnyfo
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

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

Similar topics

6
by: Paul T. Rong | last post by:
Dear all, Here is my problem: There is a table "products" in my access database, since some of the products are out of date and stopped manufacture, I would like to delete those PRODUCTS from...
1
by: x taol | last post by:
i want to set the caption of specific field using vba. *** Sent via Developersdex http://www.developersdex.com ***
2
by: RICHARD BROMBERG | last post by:
I want to add a command button which will add a record to an Access table. I would also like to add another command button which will delete a record from the same table. I searched Google for...
6
by: satish mullapudi | last post by:
Hi All, I am getting strange situation. These r the steps I have followed: 1. Created an EMPLOYEE table with around 14 fields & 688038 records. (so a large table indeed). 2. Tried to delete all...
8
by: cygsoft | last post by:
Hi, I have got the codings for inserting and displaying the records in the database. But i couldn't able to delete a specific row, which is created dynamically. i.e, if i give any one of the...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
1
by: elbatz | last post by:
Hi! Does anyone know the code of how to delete records in access using excel as reference. example: Delete * FROM table1 WHERE table1.ID=excelfile.ID ? Thanks
6
by: scott.tang | last post by:
I'm experiencing a very strange problem. My application is MS Access front-end and MS SQL server back-end database. I have a SQL statement that deletes records from a table after an export...
1
by: tembil | last post by:
Hi, I'm designing a windows application in visual studio 2008 and connecting to oracle 10g XE but don't know how to add, update and delete records from my database using text boxes. Thanks in...
2
by: anoop s | last post by:
I want to delete records of one table that exist in another table. The tables have no primary key. It will take a lot of time compare field by field. Is there any method record by record comparison...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.