Hi all - I'm trying to construct a search query on a particular field that has text contained within a specific format...
The text will be a combination of numbers and letters (hence the problem) but the format will always be the same...
I'm using the following formula, which works great when I know what the text is:
ProjID: IIf(InStr(1,[Transaction Description],"ABC"),Mid([Transaction Description],InStr(1,[Transaction Description],"ABC"),13))
When I use this formula, an example result I get is "ABC US3-BG020". I don't want the ABC part included in the result and there are times where ABC isn't in the field but the result I want is, so I can't rely on "ABC" as criteria.
What I would like to do is replace the "ABC" portion of the formula with a specific format and then have the query return the result..
For example, the format I'm looking for is "###-#####", where results would be something like "US3-BG020". The results can be a wide variety of letters and numbers but the format will always be 3 characters and a dash followed by 5 characters.
Any idea how I can construct the formula to give me the results I want? I can always run the query search as above and then do an update query to remove the "ABC" but would prefer to do it in one step if possible.
Thanks for the help!
Ron
The text will be a combination of numbers and letters (hence the problem) but the format will always be the same...
I'm using the following formula, which works great when I know what the text is:
ProjID: IIf(InStr(1,[Transaction Description],"ABC"),Mid([Transaction Description],InStr(1,[Transaction Description],"ABC"),13))
When I use this formula, an example result I get is "ABC US3-BG020". I don't want the ABC part included in the result and there are times where ABC isn't in the field but the result I want is, so I can't rely on "ABC" as criteria.
What I would like to do is replace the "ABC" portion of the formula with a specific format and then have the query return the result..
For example, the format I'm looking for is "###-#####", where results would be something like "US3-BG020". The results can be a wide variety of letters and numbers but the format will always be 3 characters and a dash followed by 5 characters.
Any idea how I can construct the formula to give me the results I want? I can always run the query search as above and then do an update query to remove the "ABC" but would prefer to do it in one step if possible.
Thanks for the help!
Ron