I am using VBA to filter records in an MS Access Database I first need to clean the data in a particular column
An example item in this column would be XXXZZZSTYS1234NCYORGxxxASD
What i would like to do is if the string contains STY then remove subsequent characters until you reach COYORGxxx or NCYORGxxx or CNYORGxxx and then remove any characters after the ORGxxx if they exist
So in the example above it would be cleaned to XXXZZZSTYNCYORGxxx
It doesn't have to be VBA, I use notepad++ to test it