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
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