Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2005
    Posts
    4

    A Text file has a maximum characters per line?

    I've already gather some nice suggestions on how to export an access table to text, but since i'm working on an App to create such file for another App to read it I got a sample of the text file to check out the structure and it turns out that the file is fixed width and each record divides into 4 lines . Any suggestion on how i can create Such file or Is that the Text file has a maximum characters per line?

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    As far as I know, a text file can be a continuous stream of characters. The File can be lets say 20K in size and be one line. What determines a new line is when a Carriage Return/Linefeed is encountered within the stream.

    You can use DAO or ADO to read the Field names and table data then use the Open statement in conjuction with the Print # statement to create your text file in basically whatever format you like (within the bounds of text file capabilities). Tab delimiting is the most common choice where each data field is delimited (spaced) with a Tab character (Chr$(9)).

    It really does'nt matter how you format your text file (as far as I'm concerned), as long as your reading application can correlate with it and retrieve the data effectively and reliably.

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Are you sure the each line is four lines? Are you using Notepad to view the file? Do you have Word Wrap on?

    If not then your only course of action is writing code to output a file like that. There is nothing in the Export Wizard that allows you to put in multiple carriage returns in one record.

    If you are doing a fixed width file then you will probably want to get familiar with the String function and the Left function.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    12,517
    fixed lne length, multiple lines per record - sounds like a COBOL or card image.

    I think to export this you will need to use a custom written VB function.

    Id check the destination program, or use a hex / binary editor to fidn what the line separator character is, and if there is also a record terminator

    some progemas expect a separation character for each field, soem just for text / non numeric fields.

    I'd check to ensure that any numbers you send are sent in the correct format, not all countries use the decimal point '.' some use a comma.

    Depending on how old the destiantion program is you may also need toensure that you use the correct character set, and or use / not use unicode.

    Just guessing: but I suspect its probably going to be a plain vanilla ASCII file As CyberLyunx suggets it could use a comma, or tab to deliniate fields, it could use a " or ' to delinaitate fields or optionally non numeric fields.

    it could use the windows end of line sequence or 'the other format' VB has a predetermined function vbcrlf to generate the windows compatible sequence _ I forget the format for UNIX boxes.

    good luck

  5. #5
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,275
    Quote Originally Posted by mkl757
    I've already gather some nice suggestions on how to export an access table to text, but since i'm working on an App to create such file for another App to read it I got a sample of the text file to check out the structure and it turns out that the file is fixed width and each record divides into 4 lines . Any suggestion on how i can create Such file or Is that the Text file has a maximum characters per line?
    look like you are playing With EDI

    For A Fix Lenght Feild

    some code I wrote to make a data a fixed length



    Code:
    Function EDIOUT(FeildDATA, Lenght)
    Dim DatLength
    Dim NewSpace
    DatLength = Len(FeildDATA)
    
    If DatLength >= Lenght Then
    EDIOUT = Mid(FeildDATA, 1, Lenght)
    Else
    NewSpace = Lenght - DatLength
    EDIOUT = FeildDATA & String(NewSpace, " ")
    End If
    End Function
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE

  6. #6
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    myle,

    A little trick to make your function shorter is using the Left function:

    <code>
    Function EDIOUT(FeildDATA, Lenght)

    EDIOUT=Left(FeildDATA & String(Lenght," "),Lenght)

    End Function
    </code

    Just FYI.

  7. #7
    Join Date
    Oct 2005
    Posts
    4
    Well here's a copy of the file ... just to clear up your thoughts...Thank you guys!!x Any sugg will be greatly appreciated.. ....
    Attached Files Attached Files

  8. #8
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,275
    Quote Originally Posted by DCKunkle
    myle,

    A little trick to make your function shorter is using the Left function:

    <code>
    Function EDIOUT(FeildDATA, Lenght)

    EDIOUT=Left(FeildDATA & String(Lenght," "),Lenght)

    End Function
    </code

    Just FYI.
    good nice thinking out side the square
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE

  9. #9
    Join Date
    Oct 2005
    Posts
    4
    I thought I had some nice suggestions at first, but as it turns out I'm almost more confused than when I Started... that might be related that I've been watching programs develop from the viewer seat the last couple of years... Anyhow I will need to catch up on some reading to pull this thing off, but I will need to know which is the better approach to achieve this (I'm not expecting the code, just what should I try... so I can make the best of the tuime that I have available) ThanX!!

Posting Permissions

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