ilfocorp
asked on
Getting Inner String
I have a Access 2010 table that I am stepping through in my VB Script. One of the the fields have information similar to the below. I would like to assign the inner value "226013058996" of the field to a variable. Can someone help me with the script that would pull that out. Thank you.
field:
PAYMENTECH DEPOSIT 111103 226013058996 LL FACTUAL-
field:
PAYMENTECH DEPOSIT 111103 226013058996 LL FACTUAL-
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Sounds like you need to do a regular expression to get that field of numerical characters. So a couple of questions. Will they always be numberical with 6 numberical followed by space and then 12 numberical (the ones you want to capture)?
Can you provide additional samples for that field, and the data you want extracted?
The real question is what is the "pattern" to the data in that field. Like is the subdata you want always in the same character position? Or always preceded or followed by certain data? Are spaces used as a delimiter, etc.
~bp
The real question is what is the "pattern" to the data in that field. Like is the subdata you want always in the same character position? Or always preceded or followed by certain data? Are spaces used as a delimiter, etc.
~bp
ASKER
Had the right idea and I took it to another point and used the following;
Dim SearchString, SearchChar, MyPos, CRef
Set rsImp = dbLD.OpenRecordset("Import Tbl_WF")
If table(field) Like "*PAYMENTECH DEPOSIT*" Then
SearchString = table(field)
MyPos = Left(SearchString, 38)
CRef = Right(MyPos, 12)
With table
.Edit
.Fields(6) = CRef
.Update
End With
End If
Dim SearchString, SearchChar, MyPos, CRef
Set rsImp = dbLD.OpenRecordset("Import
If table(field) Like "*PAYMENTECH DEPOSIT*" Then
SearchString = table(field)
MyPos = Left(SearchString, 38)
CRef = Right(MyPos, 12)
With table
.Edit
.Fields(6) = CRef
.Update
End With
End If