Query: Add a numbers that follow a particular text sting

  • Thread starter Thread starter Rob McShinsky
  • Start date Start date
R

Rob McShinsky

I am having trouble trying to sum the number of pages printed for a
particular printer. Using the Microsoft Utility EventComb, we can get a
text string that looks like the following:
EventCombMT EventText
Document 155, Reservations owned by Madalyne N. Huntingt was printed
on LEB-CONF1 via port LEB-CONF1:PASSTHRU. Size in bytes: 72665; pages
printed: 2


The number of pages printed always follows the text "pages printed: " I
want to be able to sum, in a query, the number that follows this (could be
1-4 positions) when I pick a particluar printer (I already have this piece
worked out). Any thoughts.

Rob McShinsky
 
The number of pages also always follows the last space, correct? If so use
this function to get the position of the last space, then grab the number:

Function RightInstr(strString As String, strCharacter As String)
'*********************************************************
' Name: RightInstr
' Purpose: Counts the position of the last occurence of a character in a
string
' Author: Arvin Meyer
' Date: 02/03/97
' Comment:
'*********************************************************
On Error GoTo Err_RightInstr

Dim intPos As Integer
intPos = Len(strString)

Do While intPos > 0
If InStr(intPos, strString, strCharacter) <> 0 Then
RightInstr = intPos
Exit Do
Else
intPos = intPos - 1
End If
Loop

Exit_RightInstr:
Exit Function

Err_RightInstr:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_RightInstr

End Function

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top