473,327 Members | 2,090 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,327 software developers and data experts.

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 2617
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
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
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
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
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
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
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
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
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
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
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
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
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.