Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Verification of Text File (Access 97)

    Don't know if this really needs to be a post for access or not. I am given a list of text files that all have a final record that is a list of nines and a date time stamp. I currently run a process from access that imports these files every four hours and we do other stuff with them. I need to somehow run a process that will verify all of the date times in each text file are the same before I run the process I currently have. I would like to stay away from importing and then checking the date time. Any suggestions?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Verification of Text File (Access 97)

    Another option is to use the Open statement to read the text file directly, but it's a lot more work and effort than simply importing the file in the first place.
    Charlotte

  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Verification of Text File (Access 97)

    Any suggestions for doing something like this outside of access?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Verification of Text File (Access 97)

    If you mean completely outside of Access, this is not the right Forum to ask the question.

    If you mean that you want to check the file from within Access but without importing it, Charlotte has given you the answer: you can use the Open instruction, but it will be more work than importing the file, checking the imported table and deleting it if it doesn't meet the criteria.

    If the text file is comma delimited, and the date/time is enclosed in # symbols, you can use the Input instruction to read data. Say the file looks like

    "Some text",19290
    ...
    "9999",#6/19/2002 8:08 AM#

    You can use:

    Dim Var1, Var2
    Open "C:TestMyFile.txt" For Input As #1 ' Open file for input.
    Do While Not EOF(1) ' Loop until end of file.
    Input #1, Var1, Var2 ' Read data into two variables.
    Loop
    Close #1 ' Close file.

    At the end, the date/time will be in Var2.

    If the text file is not comma delimited, you can use the Line Input instruction to read data. say the file looks like

    Some text19290
    ...
    9999999996/19/2002 8:08 AM

    Now use

    Dim Var1
    Open " C:TestMyFile.txt" For Input As #1 ' Open file for input.
    Do While Not EOF(1) ' Loop until end of file.
    Line Input #1, Var1 ' Read data into variable.
    Loop
    Close #1 ' Close file.

    At the end, the last line of the file will be in Var1. You will have to parse it yourself to get the date/time.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Verification of Text File (Access 97)

    If you're going to have to check all the dates, what's the point in doing it outside Access, where you can simply run a query to return unique dates. If you intend to physically "look" at the file, open it in Excel.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •