I'm getting a string from a text box in a form and need to substitute some values with other values, and take the remainder of the string contents and reformat them.
An example of what I'm getting from the text box would be something like:
What I want at the end would look something like this:
AND TableName.ColName like ‘*DEQ*’ AND TableName.ColName like ‘*DEP*” AND TableName.ColName like ‘*QN*’ OR TableName.ColName like ‘*BN*’
where the semicolon is substituted for AND and the colon is substituted for OR.
Some previous code I’ve used (when I was parsing just the semicolon looks like this:
If Nz(Me.TxtAttribute5) <> "" Then
spartse = Split(Me.TxtAttribute5, ";")
For e = LBound(spartse) To UBound(spartse)
strLste = strLste & " AND " & "TBQM_Basis.Desc Like '*" & spartse(e) & "*'"
strWhere = strWhere & strLste
What has me stumped is parsing for a second condition (or for no conditions). I’ve tried other nested if statements and also get that I probably need to be looking for the semicolon and the colon at the same time (otherwise, whichever you don’t search for first becomes part of the string) but think there is probably a more elegant way to approach the problem, so I’m putting this out there.