Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This site is truly a marvel. Without a doubt the most comprehensive, friendly and just plain useful resource of its kind..."

Geography

Where in the world do Tek-Tips members come from?
Sdaddy (MIS)
13 Oct 03 18:39
I am really tired and should know this.... but I need help getting an ID field on a text that is right justified to grab the up to 4 number id from right to left. PLEASE HELP!!! I'm stuck until i figure this out.  

Here's my function
Option Compare Database
Option Explicit

Public Function TU1()

Dim dbsTime As Database
Dim rsttable As recordset
Dim f As String
Dim a As Integer, b As Integer
Dim datastring As String

f = InputBox("What is the TXT file", "Text file", "")
f = "L:\HFC Trouble Ticket Database\" & f & ".TXT"

Open f For Input As #1
Set dbsTime = CurrentDb()
Set rsttable = CurrentDb().OpenRecordset("TmeUtl")

Dim mu As Integer, ID  As String, min As Integer
Dim datee As String, fn As String

datee = ""
mu = 0
ID = 0
min = 0
fn = ""
b = 0

Do While Not EOF(1)

    a = 0
    
    Line Input #1, datastring
        
    If Mid(datastring, 4, 1) = "MU: " Then mu = LTrim(RTrim(Mid(datastring, 5, 3)))
    
    If Mid(datastring, 37, 6) = "Date: " Then datee = Mid(datastring, 43, 8)

    If Mid(datastring, 9, 1) = "0" Then a = 1
    If Mid(datastring, 9, 1) = "1" Then a = 1
    If Mid(datastring, 9, 1) = "2" Then a = 1
    If Mid(datastring, 9, 1) = "3" Then a = 1
    If Mid(datastring, 9, 1) = "4" Then a = 1
    If Mid(datastring, 9, 1) = "5" Then a = 1
    If Mid(datastring, 9, 1) = "6" Then a = 1
    If Mid(datastring, 9, 1) = "7" Then a = 1
    If Mid(datastring, 9, 1) = "8" Then a = 1
    If Mid(datastring, 9, 1) = "9" Then a = 1
    
    If a = 1 Then
        b = 0
        ID = mid(datastring, 1,5)
            
        a = 0
    End If
    
    If Mid(datastring, 1, 7) = "Summary" Then b = 1
    
    If Mid(datastring, 70, 1) = "." And Mid(datastring, 73, 1) = "%" And b = 0 Then
    
        fn = Trim(Mid(datastring, 33, 22))
        min = 60 * Trim(Mid(datastring, 59, 3)) + Trim(Mid(datastring, 63, 2))
        If b = 0 Then AddInTU rsttable, datee, mu, ID, fn, min
    End If

Loop


Close #1

End Function
Public Function AddInTU(rsta, datea, mua, IDa, fna, mina)

With rsta
    .AddNew
    !IEXid = IDa
    !Date = datea
    !Function = fna
    !minutes = mina
    !Time = Now()
    !mu = mua
    .Update
    .Bookmark = .LastModified
End With

End Function
Sdaddy (MIS)
13 Oct 03 18:44
As a follow up, my problem is that I need the line that reads
ID = mid(datastring, 1,5) to start at the 9th position and look back 4 positions and input that into the first column of my table.  PLEASE HELP



Helpful Member!  DrJavaJoe (Programmer)
13 Oct 03 19:49
So if datastring = 1234567890 you are saying you want 6789 or 9876.

6789 = Mid(datastring,6,4)
9876 = strReverse(Mid(datastring,6,4))

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close