Regex and Form Controls with Select Case (1 Viewer)

dstahl81

Registered User.
Local time
Today, 05:02
Joined
Feb 21, 2018
Messages
11
The code runs great in Access 2013 but not in Access 97. I found code to substitute for Split and FindReplace but I keep getting an error on UBound (var) and I feel it's something with the split code I had to insert.

Let me clarify, the original code does work but not in Access 97 as there are some functions unavailable.


Split code below.
Function ySplit(ByVal pTarget As String, _
pItem As String, _
Optional ShowLeft As Boolean = True) _
As String
'*******************************************
'Purpose: Splits a string to the left or
' right of pItem
'Coded by: raskew
'Inputs: 1) ? ySplit("The quick+ brown fox", "+", True)
' 2) ? ysplit("The quick+ brown fox", "+", False)
'Output: 1) The quick
' 2) brown fox
'*******************************************

Dim strLeft As String
Dim strRight As String
Dim n As Integer

n = InStr(pTarget, pItem)

If n = 0 Then
ySplit = pTarget
Else
ShowLeft = IIf(IsMissing(ShowLeft), True, ShowLeft)
strLeft = Trim(Left(pTarget, n - 1))
strRight = Trim(Mid(pTarget, n + 1))
ySplit = IIf(ShowLeft, strLeft, strRight)
End If

End Function
 

Users who are viewing this thread

Top Bottom