473,385 Members | 1,736 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,385 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 1044
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.