A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Delete records



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2004, 10:51 AM
Daniel
external usenet poster
 
Posts: n/a
Default Delete records

In a table I have two columns that may sometimes hold the
same codes, for Example:

Col1 Col2
xxxx xxxx
yyyy zzzz
pppp pppp

I need to run a query that will update col1 to null where
the code is the same as what is in col2 so the rsult
would be:
Col1 Col2
xxxx
yyyy zzzz
pppp

How would I go about this...please help...really stuck
with this!

Thanks


  #2  
Old May 27th, 2004, 11:41 AM
Nikos Yannacopoulos
external usenet poster
 
Posts: n/a
Default Delete records

Daniel,

Open a new query in design view, select the table and drag and drop the two
fields from the table down to the grid. Then in the grid, under Col2, type
[Col1] in the first criteria line (if the name of the filed is not Col1 then
type in tyhe exact name of the field). So far you have a Select query that
selects records where Col1 = Col2. Switch to datasheet view to verify. Then,
back to the design view, go to menu Query Update query, to change the type
of your query from Select to Update. Notice the new line headed Update To
that appears in the grid. Go to that line under field Col1 and type in it
"Null" (without the quotes). Now go to menu Query Run, confirm when
prompted to accept the cahnges, and you're done.

HTH,
Nikos



"Daniel" wrote in message
...
In a table I have two columns that may sometimes hold the
same codes, for Example:

Col1 Col2
xxxx xxxx
yyyy zzzz
pppp pppp

I need to run a query that will update col1 to null where
the code is the same as what is in col2 so the rsult
would be:
Col1 Col2
xxxx
yyyy zzzz
pppp

How would I go about this...please help...really stuck
with this!

Thanks




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.