By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,651 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,651 IT Pros & Developers. It's quick & easy.

Delete Field Content - Using Query or code

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.