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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how can I replace SQL query with VBA logic



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old May 13th, 2010, 02:38 PM posted to microsoft.public.access.forms
mls via AccessMonster.com
external usenet poster
 
Posts: 46
Default how can I replace SQL query with VBA logic

I have a table which looks like the following..
Sample group TestNo
29045 IG Test 1
29053 IG Test 1
29053 IR Test 1
29067 IG Test 1
29067 IR Test 1
and I need to correct my TestNo, If the sample is same and group is different
then I need to assign different no, My query looks like this..
DoCmd.RunSQL "UPDATE tbl_Results set TestNo='Test 2' where group='IG' and
TestNo='Test 1';"
this query updates every row with IG whcih is not correct. I wan to update
only if the sample is same and group is different. I want to get values of
FixedNo and not ErrorNo.
For this I need to use count(*) and having having count 2 but how can I do
this. Is there a way to do this in VBA?
ErrorNO FixedNo
Test 2 Test 1
Test 2 Test 2
Test 1 Test 1
Test 2 Test 2
Test 1 Test 1

Thanks a lot

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1

 




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 12:53 AM.


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