I need to strip the first couple of letters (it varies) off of the beginning of a field. I have the following code, which should do it. This code is in a module in my database. My problem is, I don't know how to utilize the module in my query. I'm pretty sure that this is easy to do, but I'm very new to Access, so.....
Any help would be greatly appreciated.
sample fields to strip:
original: stripped:
ss-323-saer-23 323-saer-23
316-123-123-123 123-123-123
(I need to strip all characters up to and including the first dash '-')
Function strip(strIn As String) As String
Dim Index As Integer
Dim return_string As String
Dim flag As Boolean
flag = False
Index = 1
Do While Index < Len(strIn)
If Mid(strIn, Index, 1) = "-" Then
If flag = False Then
flag = True
return_string = Mid(strIn, Index + 1, Len(strIn) - Index)
End If
End If
Index = Index + 1
Loop
strip = return_string
End Function
Any help would be greatly appreciated.
sample fields to strip:
original: stripped:
ss-323-saer-23 323-saer-23
316-123-123-123 123-123-123
(I need to strip all characters up to and including the first dash '-')
Function strip(strIn As String) As String
Dim Index As Integer
Dim return_string As String
Dim flag As Boolean
flag = False
Index = 1
Do While Index < Len(strIn)
If Mid(strIn, Index, 1) = "-" Then
If flag = False Then
flag = True
return_string = Mid(strIn, Index + 1, Len(strIn) - Index)
End If
End If
Index = Index + 1
Loop
strip = return_string
End Function