User Profile

Collapse

Profile Sidebar

Collapse
JEFFREY MUSGRAY
JEFFREY MUSGRAY
Last Activity: Mar 10 '11, 10:13 AM
Joined: Feb 28 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • JEFFREY MUSGRAY
    started a topic How skip to next line?

    How skip to next line?

    I am reading the text file and it works fine, until a start of string is not present. In that case it begins at start of text file and inserts all data to end point.

    For example: ![TypeOfService] = getValue(strCon tent, 104, 105)

    If there is no "104" in the file, it begins at beginning and copies all data to the end point of 105.

    I hope I explained this clearly. I attempted on Line 41 but, I...
    See more | Go to post

  • Thanks, as always you educate me. The error was invalid argument
    See more | Go to post

    Leave a comment:


  • JEFFREY MUSGRAY
    started a topic why does this error out at last line

    why does this error out at last line

    Code:
    Public Function getValue(strInput As String, lngStart As Long, Optional lngEnd As Long = 0)
        'Get starting location
            Dim lngPosStart As Long
            Dim strStart As String
            strStart = vbCrLf & lngStart & "."
            lngPosStart = InStr(1, strInput, strStart) + Len(strStart)
        'Get end location (if any)
            Dim lngPosEnd As Long
            If lngEnd
    ...
    See more | Go to post

  • Thank you sir for your reply-I am fairly new at the VBA side of access. I tried what you said and I still get compile errors. I am just trying to import a text file-the complete code is attached. Can you tell me what is wrong with this code (I know I need to correct the heart)Thanks in advance

    Code:
    Option Compare Database
    Option Explicit
    Public Function readFile(Optional strPath As String) As String
        'Create
    ...
    See more | Go to post

    Leave a comment:


  • JEFFREY MUSGRAY
    started a topic compile errors Expected expression

    compile errors Expected expression

    I have received alot of help from this site and I am grateful. My problem is that I was able to get the first part of code to work. I tested it via the immediate window. I received the compile error "expected expression" when I tested for function InputFile.

    ?InputFile(Opti onal strPath As String)
    "expected expression"

    ?InputFile()
    "expected function or variable"
    Below is the...
    See more | Go to post
    Last edited by Dormilich; Mar 4 '11, 10:50 AM. Reason: please use [CODE] [/CODE] tags when posting code

  • I took your advice and researched a bit-I receive a argument is not optional error when I call this. For instance referring to code below:

    Call InputFile (should there be a variable here)as I believe the procedure is looking for one. Am I still off target?




    Public Sub InputFile(strPa th As String)
    Dim strContent As String
    strPath = "C:\Users\Jeff\ Desktop\TcossDo cument.txt"...
    See more | Go to post

    Leave a comment:


  • I agree with you and I thank you very much for your assistance and patience. Be blessed
    See more | Go to post

    Leave a comment:


  • I am sorry just to understand the code should look like this
    Public Function readFile(strPat h As String) As String
    'Create a filesystemobjec t

    Dim fso As Object
    Set fso =

    CreateObject("s cripting.filesy stemobject")

    'Open file for reading
    Dim strFileContent As String
    strFileContent = readFile("C:\Im portFiles\myFil e.txt")...
    See more | Go to post

    Leave a comment:


  • I understood that it is not complete-I was trying to get it to read file-I assumed I was coding it wrong as to why I was getting compile error (the function or sub not defined) I was only working with the read portion of code
    See more | Go to post
    Last edited by JEFFREY MUSGRAY; Mar 1 '11, 11:41 AM. Reason: added info

    Leave a comment:


  • I must being doing something wrong-I pasted the code in ACCESS but I continue to get an error. Sub or Function not defined. I am just learning this aspect of access, please be patient. Should I replace strPath with location of file?
    See more | Go to post

    Leave a comment:


  • Thank you very much-it is greatly appreciated. I must being doing something wrong-I pasted the code in ACCESS but I continue to get an error. Sub or Function not defined. I am just learning this aspect of access, please be patient. Should I replace strPath with location of file?
    See more | Go to post
    Last edited by JEFFREY MUSGRAY; Mar 1 '11, 11:20 AM. Reason: missed info

    Leave a comment:


  • I will receive a new file every time so it will need to append
    See more | Go to post

    Leave a comment:


  • Thank You for your quick response-Can you show or guide me how I would write the first line to create the table aspect. I can follow after that

    Basically when it is read into access I want a table that
    that has fields named [TSR Number] [Type Action][TYPE OF SERVICE][NETWORK REQUIREMENTS] and the corresponding information from the text in that field i.e. After reading the text [TSR Number] would have "EJ13JAN102 064"...
    See more | Go to post

    Leave a comment:


  • How to import text file to access and assign value to table?

    I have a text file that I want to read and assign parts to a certain field in MS Access table

    When you look at this file you will see numbers with corresponding info Ex: 120A. CMPBLLBK I want to have 120A be called “Location” and “CMPBLLBK” be populated in that location.

    Basically when it is read into access I want a table that
    that has fields named [TSR Number] [Type Action][TYPE OF SERVICE][NETWORK...
    See more | Go to post
No activity results to display
Show More
Working...