473,569 Members | 2,490 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 2636
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
16984
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 must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then...
5
5024
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
2299
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 field PK. This code works when executed from a module (both DAO and ADO work), but not from the query window. DELETE a1.*, a2.Field1 FROM a1 LEFT...
1
2824
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 field PK. This code works when executed from a module (both DAO and ADO work), but not from the query window. DELETE a1.*, a2.Field1 FROM a1 LEFT...
6
1948
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 FROM Table1 GROUP BY Table1.Date;
3
3434
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 the necessary records in it when testing it. I get the error "No value given for one or more required parameters." when I try to update the...
3
13730
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. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should...
9
2785
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 this: id Name Surname pictr0 picrt1 pictr2 pictr3
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 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...
3
3417
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. Filename : search_student.php <?php include("../user_access/user_access_control.php"); include("../Database/database.php"); $searchStudentControl =...
0
7618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5222
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.