473,508 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete Field Content - Using Query or code

Hi,

I have a table (tblResults) that was created uning a make table query.
I will be using the table to export the results of the query to a csv
file.

Every field in the first 2 columns of the table (tblResults) is
populated as expected but now I want to automate removing any data from
these 2 columns below the first row while leaving the data in columns 3
-10 untouched.

How can I automate the removal of the contents of specific fields in a
table using a query or through code.

Thanks in advance
Paul

Jul 14 '06 #1
2 2629
Hi Paul,

To remove data from columns in a table but still retain the rows would
be a Table Update. With Sql you can Delete Rows Insert Rows, and Update
rows. These are the three basic action queries.

In your scenario, to update your table you need to be able to identify
the row that you don't want to update. Lets say you have an ID field
and you know what that ID is. Then you can write a sql statement like
this:

Private Sub Button1_Click(...)
DoCmd.RunSql "Update tbl1 Set fld1 = '', fld2 = '' + _
& "Where RecordID <1"
End Sub

This will clear fld1 and fld2 for all rows in your table excpet the row
where the RecordID = 1.

HTH

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Jul 14 '06 #2
Hi Rich,

Thanks a million! That worked a treat.

Cheers

Paul

Rich P wrote:
Hi Paul,

To remove data from columns in a table but still retain the rows would
be a Table Update. With Sql you can Delete Rows Insert Rows, and Update
rows. These are the three basic action queries.

In your scenario, to update your table you need to be able to identify
the row that you don't want to update. Lets say you have an ID field
and you know what that ID is. Then you can write a sql statement like
this:

Private Sub Button1_Click(...)
DoCmd.RunSql "Update tbl1 Set fld1 = '', fld2 = '' + _
& "Where RecordID <1"
End Sub

This will clear fld1 and fld2 for all rows in your table excpet the row
where the RecordID = 1.

HTH

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Jul 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
16975
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
5
5015
by: hpi | last post by:
Hello, I have a table : Batch It contains fields batchnummer : Number (Long Integer) datum : Date/Time status : Number (Long Integer) nr_records : Number (Long Integer)
2
2294
by: Matthew Wells | last post by:
I want to delete records from the "one" table of a one to may relationship. There are no actual Access relationships set up. The "one" table has a single field PK and the "many" table has a two...
1
2821
by: Matthew Wells | last post by:
I want to delete records from the "one" table of a one to may relationship. There are no actual Access relationships set up. The "one" table has a single field PK and the "many" table has a two...
6
1936
by: Mark Reed | last post by:
Hi all, Please help. I have a table with 2 fields of which I am trying to change a select query into a delete query. the select query is: SELECT Table1.Date, Min(Table1.Ball) AS MinOfBall...
3
3427
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
3
13725
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
9
2778
by: Dejan | last post by:
Hy, Sorry for my terreble english I have this simple code for deleting rows in mysql table... Everything works fine with it. So, what do i wanna do...: my sql table looks something like...
0
343
by: pmc1 | last post by:
Hi, I have a table (tblResults) that was created uning a make table query. I will be using the table to export the results of the query to a csv file. Every field in the first 2 columns of...
3
3414
by: bluez | last post by:
I want to design a webpage where user can search the data from the database and list out the related records. Each of the record got a delete button which allow user to delete the record. ...
0
7223
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
7115
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
7321
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,...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.