Sample Data:
EA
CS/12 EA
BX/4 PK/50 EA
BX/5 RL
PK/3 EA
CS/12 EA
BX/100 EA
BX/1 RL/2800 EA
CS/20 BX/250 EA
CT/10 PK/25 EA
PD/100 EA
CT/10 PK/100 EA
This is in a row and I need to have the (EA,CS,PK) to have a one and the
ones with BX/4 RL to have the 4 and the ones with two numbers to be
multiplied together (CT/10 PK/100 EA) = 1000. I have done this in excel but
I am not sure how to make it happen in access. The file is to big to put
into excel.
Any and all help would be appreciated.
Thanks,
--
Thomas
--
Duane Hookom
MS Access MVP
"T Miller" <TMi...@discussions.microsoft.com> wrote in message
news:C12F4B89-747B-4B7C...@microsoft.com...
--
Thomas
Function GetQty(pstrPkg As String) As Long
Dim lngOut As Long
lngOut = 1
Dim intLen As Integer
Dim intChar As Integer 'which character to examine
Dim intNum As Integer 'found number in string
intLen = Len(pstrPkg)
For intChar = 1 To intLen
If IsNumeric(Mid(pstrPkg, intChar, 1)) Then
'get the value of the found number
intNum = Val(Mid(pstrPkg, intChar))
'multiply the values
lngOut = lngOut * intNum
'skip characters to a non-numeric
intChar = intChar + Len(Trim(Str(intNum)))
End If
Next
GetQty = lngOut
End Function
--
Duane Hookom
MS Access MVP
"T Miller" <TMi...@discussions.microsoft.com> wrote in message
news:E0ADB569-9287-402A...@microsoft.com...