Prev: GotoControl in a Navigation Form
Next: Access 2010 white paper about manageability and migration
From: ManningFan on 12 Feb 2010 13:42 On Feb 12, 11:46 am, Rich P <rpng...(a)aol.com> wrote: > When you say sometimes there are record separators and sometimes not - > that doesn't make sense. I you are reading a file using Line Input - > that would be the record separator - each line (each carriage return). > Or, if the text file is just one continuous line - then Line Input would > only read one line (with say - 100,000 chars). If that is the case > (which I doubt) then you are on your own. Rich - That's exactly what it's doing. With EBCDIC files, it's just seeing one huge record, even though there really should be about 100,000 individual records. I tried doing a Mid() function (because I usually know how long the record should be and figured I could pass it in a variable) but it kept overflowing when it hit ~32k characters.
From: Rich P on 12 Feb 2010 14:16 Make sure you Dim i As Long, j As Long, k As long and not Integers. Integers can only take up to something like 32,500 or less bytes (someting to do with the number 32,000 something). Longs go up to 2,000,000,000+. That should prevent the overflow error. So obviously you (the human) know when a record in your text file ends (like by number of chars in a line or some specific character). You can read the entire text string and break it up into chunks of say 5000 chars per chunk (or whatever). For files like that I read then into a table with a memo field, then I parse out the memo field into respective fields. Here is some code to give you some ideas what you can try Dim L1 As string, i As Long, j As Long, k As Long Dim bEnd As Boolean, str1 As string L1 = ... bEnd = False i = 1 Do While bEnd = False str1 = Mid(L1,i,5000) '--that is 5000 chars, or 3000 ... DoCmd.RunSql "Insert Into temp1(fld1) Select '" & str1 & "'" i = i + 5000 If i >= Len(L1) then bEnd = True Exit Do End If Loop table temp1 contains 1 memo field that I named fld1 Rich *** Sent via Developersdex http://www.developersdex.com ***
First
|
Prev
|
Pages: 1 2 Prev: GotoControl in a Navigation Form Next: Access 2010 white paper about manageability and migration |