Working in Access 2000 on XP box:
VBA code uses Select Case structure to search a text file for a string pattern...
Certain lines within the text file have the form of "[some player] showed [As Kd] and won....." where '[As Kd]' means the player was holding the Ace of spades and the King of diamonds. The second Case criteria above ought to evaluate to True when these certain lines are parsed, however, it is not working.
In plain language, what I think I've written in the second Case criteria is this: If a line contains a pattern like (any one of the following letters) A-K-Q-J-T or a number 0-9 followed by (any one of the following letters) s-c-d-h, followed by a space, then (any one of the following letters) A-K-Q-J-T or a number 0-9 followed by (any one of the following letters) s-c-d-h, evaluate to True and process the next line of code. The two asterisks at the front and end of the pattern simply say any characters in any quantity can come before and after the pattern.
Set watches to step through the code by line, and when I hit the text line that I think will evaluate to True, it doesn't.
My sneaking hunch is that VBA does a terrible job of handling regex, which is basically what the Like operator is doing, but I'm hopeful there's some little trick someone out there knows that will make this work. Or maybe a more elegant solution?
Thanks
"There is no spoon..." - anonymous enlightened child
VBA code uses Select Case structure to search a text file for a string pattern...
Code:
Do Until StrComp(PSrsc.Fields("Field1"), "NEW HAND", vbBinaryCompare) = 0
bnDeadHand = False
Select Case True
Case PSrsc.Fields("Field1") Like "*collected*"
bnDeadHand = True
Case PSrsc.Fields("Field1") Like "*[AKQJT#][scdh][ ][AKQJT#][scdh]*"
strPlayer = Replace(Left(PSrsc.Fields("Field1"), 6), " ", "")
strCards = CopyInString("[", PSrsc.Fields("Field1"), "]")
PSUpdateStr = "UPDATE Showdowns SET " & strPlayer & " = '" & strCards & "' WHERE Hand_Num = '" & strHandNum & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL PSUpdateStr
DoCmd.SetWarnings True
End Select
Certain lines within the text file have the form of "[some player] showed [As Kd] and won....." where '[As Kd]' means the player was holding the Ace of spades and the King of diamonds. The second Case criteria above ought to evaluate to True when these certain lines are parsed, however, it is not working.
In plain language, what I think I've written in the second Case criteria is this: If a line contains a pattern like (any one of the following letters) A-K-Q-J-T or a number 0-9 followed by (any one of the following letters) s-c-d-h, followed by a space, then (any one of the following letters) A-K-Q-J-T or a number 0-9 followed by (any one of the following letters) s-c-d-h, evaluate to True and process the next line of code. The two asterisks at the front and end of the pattern simply say any characters in any quantity can come before and after the pattern.
Set watches to step through the code by line, and when I hit the text line that I think will evaluate to True, it doesn't.
My sneaking hunch is that VBA does a terrible job of handling regex, which is basically what the Like operator is doing, but I'm hopeful there's some little trick someone out there knows that will make this work. Or maybe a more elegant solution?
Thanks
"There is no spoon..." - anonymous enlightened child