A while back RuralGuy very kindly helped me out with a coding problem regarding setting flags, since then I have manged to sort other small issues out using his methods but have come up against one I need a bit of help with.
I have a data table that contains the following:
CustID...............GrpNo:...........Date........ ........Flag
A123456...............A123............01/04/2010.......Y....
A123456...............A123............01/04/2010.............
A456789...............R123............01/04/2010.............
A456789...............A123............01/04/2010........Y....
A456789...............A123............01/04/2010..............
What happens is the code runs a query that goes through the CUSTID and sets a flag for the first code it finds in the GrpNo: field for that customer that is NOT an R code, this all works fine, however I have come across some customers whose entries are all R Codes i.e
CustID...............GrpNo:...........Date........ ........Flag
A123456...............A123............01/04/2010.......Y....
A123456...............A123............01/04/2010.............
A456789...............R123............01/04/2010.............
A456789...............R123............01/04/2010.............
A456789...............R123............01/04/2010..............
A456789...............R123............01/04/2010.............
A456789...............R123............01/04/2010.............
A456789...............R123............01/04/2010..............
A654852...............C765............02/04/2010........Y....
A654852...............C765............02/04/2010..............
What I need to do is flag the first R code in a customers group of entries where they are all R codes,
Can anyone help
JB