View Single Post
  #10  
Old May 15th, 2010, 07:32 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default how can I replace SQL query with VBA logic

On Fri, 14 May 2010 16:36:41 GMT, "mls via AccessMonster.com" u55943@uwe
wrote:

Sample group TestNo
29045 IG Test 1
29053 IG Test 1
29053 IR Test 1
29067 IG Test 1
29067 IR Test 1

John, In the above table, I want to update Testno, only for the records which
has same sampleid and different group( 'IG') as 'Test 2'. TestNo for record
should not change.


UPDATE tablename AS A
SET [TestNo] = "Test 2"
WHERE EXISTS
(SELECT B.[Sample] FROM tablename AS B
WHERE B.Sample = A.Sample
AND B.Group A.Group)

should work, if I understand you correctly (but back up your database first
because I probably don't!)
--

John W. Vinson [MVP]