I need to create copies of a record for each instance of a value (Project) found inside of one field within the record.
I realize this is lousy design but I have to utilize a table I cannot change.
I have a table with a fields called Document and PROJ.
PROJ lists the projects for which a (Document)record applies.
So my record looks like this:
Proj can have one or multiple values as shown above and the number of strings within PROJ will vary.
I need to have 4 records:
I thought I had a solution by doing a cartisian join against a query of ALL the possible Project codes 807A,525 etc. called qryProjectCodes and then using this formula
So for each record of the many to many query I check to see if the Project from my master list resides in the PROJ field and if so the "Exists if" statement returns a value greater than zero and I keep the record.
This worked fine [red]UNTIL[/red] I have a string in my PROJ field such as 807A and values in my list of all possible projects (qryProjectCodes) of 807 and 807A. In this situation I am returning TWO records "807" (error) and 807A (expected)as 807 is found in the string 807A.
[RED]How can I examine the strings as entire values as they are separated by commas from my PROJ fields against another entire field value.?[/RED]
I realize this is lousy design but I have to utilize a table I cannot change.
I have a table with a fields called Document and PROJ.
PROJ lists the projects for which a (Document)record applies.
So my record looks like this:
Code:
Document PROJ
XYZ "807A,525,825,545"
I need to have 4 records:
Code:
Document Project
XYZ 807A
XYZ 525
XYZ 825
XYZ 545
I thought I had a solution by doing a cartisian join against a query of ALL the possible Project codes 807A,525 etc. called qryProjectCodes and then using this formula
Code:
Exists if > Zero: InStr(1,[qryDocument]![proj],[qryProjectCodes]![ProjectCode])
and using a criteria of >0
So for each record of the many to many query I check to see if the Project from my master list resides in the PROJ field and if so the "Exists if" statement returns a value greater than zero and I keep the record.
This worked fine [red]UNTIL[/red] I have a string in my PROJ field such as 807A and values in my list of all possible projects (qryProjectCodes) of 807 and 807A. In this situation I am returning TWO records "807" (error) and 807A (expected)as 807 is found in the string 807A.
[RED]How can I examine the strings as entire values as they are separated by commas from my PROJ fields against another entire field value.?[/RED]