Carlosdl
29760 pts. | Aug 13 2009 7:34PM GMT
You could avoid the subselect in the second update, assuming that DupNameFld is null for all records at the beginning…
Update YourFile
Set DupNameFld = ‘N’
when DupNameFld is null
Carlosdl
29760 pts. | Aug 13 2009 7:46PM GMT
Or you could update all records to ‘N’ first, and then update the duplicated to ‘S’.
Update YourFile Set DupNameFld = ‘N’ Update YourFile Set DupNameFld = ‘Y’ when NameFld in ( Select NameFld from YourFile Group by NameFld Having count(*) > 1 )
Dash1
25 pts. | Aug 13 2009 9:04PM GMT
Thanks for answering my question. I do have a follow up, I’m getting a syntax error with the code, so
I think I’m typing it wrong. To help clarify, the fieldname is ‘phyname’ and the file name is ‘HSD’.
I’m getting an error on the when, but I don’t know why. Thank you.
Carlosdl
29760 pts. | Aug 13 2009 9:16PM GMT
That was a typo, it is not WHEN, but WHERE.
I modified the original answer from Philpl1jb.
Update YourFile Set DupNameFld = āNā Update YourFile Set DupNameFld = āYā where NameFld in ( Select NameFld from YourFile Group by NameFld Having count(*) > 1 )
Please change the field and table names as needed.
Philpl1jb
24520 pts. | Aug 14 2009 2:24AM GMT
Thanks for the fix Carlos - WHERE not When — mind was somewhere else.
SbElectric
1600 pts. | Aug 17 2009 3:42AM GMT
All nice suggestions and comments.
Just wanted to mention that Access 2007 provides a Wizard (Query) to display Duplicate records. One can select the field for duplicate (Name in this case) along with other associated fields. This may be helpful to ascertain if the record is genuinely duplicate.






