If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > A Text file has a maximum characters per line?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
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?
Reply With Quote
  #2 (permalink)  
Old
Stuck on my opinions...
 
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!

Reply With Quote
  #3 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 11,665
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
Reply With Quote
  #5 (permalink)  
Old
(Making Your Life Easy)
 
Join Date: Feb 2004
Location: New Zealand
Posts: 1,273
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
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
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
File Type: txt sample.txt (408.5 KB, 598 views)
Reply With Quote
  #8 (permalink)  
Old
(Making Your Life Easy)
 
Join Date: Feb 2004
Location: New Zealand
Posts: 1,273
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
Reply With Quote
  #9 (permalink)  
Old
Registered User
 
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!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On