Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Limit Length (lines) Of Text File


I have an instant messenger program and that logs each users logs separatly. I need to these files to only allow so many lines so they dont grow out of conrtrol.
Any examples on how this can be accompished?
right now its just appending each entry.

Any help is appriciated.
thanks
Garrett




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Winsock.. Limit On Text Length?
Is there a limit to how much data can be sent in 1 string? or is it just the limit of the string variable itself? if so what is that since i can't remember? if not and it is a limit on the winsock control itself.. what is that?

Limit Text Line Length
I'm writing a program that creates File_ID.diz files and want to limit each line to the standard 45 characters and wrap to the next line without breaking up the words. Anyone know how?
Thanks

Limit Length Of Text In Textbox
i know this must be simple, but i haven't been able to find the answer in any of my books. i would like to limit the number of characters allowed in a textbox to 50.
thank you in advance.

Limit Length Of Text1.text Based On Size Of TextBox?
It's been a while since I've posted in these forums, though I'm still at work on Faux-INN, my VB online games network. If you'de like you can check it out at my website.

One of the most important aspects of Faux-INN is the way the interfaces are handled - for example, the bulletin boards look like real bulletin boards. Every player can build a custom 'avatar' that looks like they do, and when you're playing an opponent in Chess, you can actually *see* who you're playing with.

I've already added e-mail (which you can view by clicking on a 'post office'), but I want to make the input not look like a regular text box, but actually look like a page of a real letter; so you can only fit so much text on a given page.

I can subclass the textbox so it looks like a 'real' page; that's not the problem. My question is... if I have a textbox of a set size, can I put limits on the amount of text you can enter into the textbox, so that you can only enter as much text as could 'fit' in the box, without scrolling?

Thanks much!

Limit The Number Of Lines In A Text Box
Can someone tell me how to limit the number of lines in a text box? I want to limit the number of lines, the user can enter into a multiline textbox. Say 20 lines and not let them enter any more than that.

Efficiently Limit A File To 100 Lines
I am developing a small app that will write a line to a file fairly frequently and I'd like to guard against the file getting longer than about 100 lines. Anyone have an efficient method to do that?

Rec Length Limit Of 32k...
Hi,
Trying to open some files in chunks, process the chunk and then open the next chunk.

The way my data is stored, the best way to process it requires opening a 'line' of data at a time.

Unfortunately this 'line' is sometimes bigger than the 32k limit on the reclength parameter of the Open file command and I get an Overflow message when I try to open the file.

Is there any easy workaround / or alternative that can be used to allow processing of the chunk at one time?

When I opened the COMPLETE file in one go, I did not have such a problem, but required a lot of memory! So I thought processing in chunks would be the best solution....

Any ideas would be great, thanks,

pete

Limit String Length
I need to limit the length of a string in my program.

Dim Calculator(1 To 14, 1 To 150, 1 To 3) As String

That is the current declaration for an array my program uses, which (apparently) takes a lot of memory; people are getting 'Runtime Error 7 Out of Memory' when they start.

Dim Calculator(1 To 14, 1 To 150, 1 To 3) As String * 64

I tried that (to limit the length of each string to 64 characters), but I am getting all these annoying spaces at the end (which cause bugs in my program), and I can't get them to go away. I have tried Trim ect.

How can I fix this? Or is there a better way to limit the length of a string?

Internetopenurl - URL Length Limit?
I'm using the code that's all over this forum for passing a url using wininet (internetOpenUrl / internetReadFile). Here is where I'm stumped...is there a length limit on the URL that I am passing into InternetOpenURL?

I have a ton of variable data in my URL ($var1=blahblah...) and if the string is longer than ~2023 then the buffer that is read back is empty. I'm stumped.

Is There A Limit For A Line Length?
Is there any limit for the length of a line in a text file? I want to write a long data to a text file and I want to write it into one line. is that possible?

INSERT Statement / Length Limit Problem
Hello,

I have an SQL statement where i an inserting about 20 items from controls into my database. The statement is so long that the VB editor wont let me make the line any longer. Is it possible to split this into parts or another method of inserting?

Thanks

Length Limit For The String Assigned To Formula1
Hi All,
  Is there a lemit on the length of the string that can be assigned to Formula1 in validation obejct

My code looks like this:
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:=StrList,

when the length StrList crosses certaion limit,I'm getting an application defined or object defined error with error code 1004
IS there any way to slove this problem

Thanks in advance
Raghu

ADO Closed Excel Workbook && Worksheet Name Length Limit
Has anyone encountered a limit in the length of a worksheet name when connected to a closed workbook used ADO.

I have noticed that when the worksheet name is 29characters long it connects fine, when it is 32 it returns an SQL/Jet DB Error, "Cannot be Found"

I haven't tried intermediate filename lengths but I can't find any documentation that states there is a limit.

Any advice?

mpk

Limit An Input Length For Style - DropDown Combo
Anyone know how to put a max length for a combo list box of Style -> 0 - Dropdown Combo ??

Text File Max Length?
Hi guys,

I was playing around reading and writing Text Files and am struggling with a limitation that seems to exist at about 100,000 characters or so. Ok, admittedly that's a lot, but I was wondering if this was some sort of built in limitation and/or if there was a way around it?

In the enclosed project there is a Text File called 'The Cathedral and the Bazaar.txt', which is a superb article by Eric Steven Raymond which can be found at: http://www.catb.org/~esr/writings/ca....html#catbmain.

Anyway, opening the Text File with a Notepad.exe results in the full length of the file being read in without any trouble. But using either:

(1) Open FileFullPath For Input As #FileNum

- or -

(2) Set oFSO = New Scripting.FileSystemObject
sFileText = oFSO.OpenTextFile(FileFullPath, ForReading).ReadAll

Seems to have a limitation at a character count of 103,413. Actually, depending on how you do it, it can cut off at 100,792. To be specific, the following cut off at 100,792 characters:
Code:
FileNum = VBA.FreeFile
Open FileFullPath For Input As FileNum
While Not EOF(FileNum)
Input #FileNum, sLineText
sFileText = sFileText & sLineText
lLineCount = lLineCount + 1
Wend

TxtFile_ReadAll_1 = sFileText
The following got a little further, cutting off at character 103,413, but still not reading in the full document:
Code:
FileNum = VBA.FreeFile
Open FileFullPath For Input As FileNum
sFileText = Input(LOF(FileNum), FileNum)

TxtFile_ReadAll_2 = sFileText
Using the Scripting.FileSystemObject using either TextStream.Read() or .ReadAll() also resulted in a cut-off at character 103,413.

I've attached a project where you can open up a file (just hit the <Command1> button to be displayed a Common Dialog to choose your file) which defaults at the 'The Cathedral and the Bazaar.txt' location; so feel free to try opening that to see the resulting count via all 4 methods and the resulting Text imported into the TextBox. If you then try opening the same file via a Notepad.exe you'll see the complete text, without it being cut off.

Is there a simple setting that needs to be changed in order to get the full length of Text stored in the file? If not, is there some advanced "trick" to do so?

Much obliged for any thoughts here...
Mike

Getting Whole Text File With Known Length
hey all basicly i know how to work with text files but i need to know how to input a whole file (which i no the length of) in to a string...

eg -

text file


x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x
x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x
x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x
x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x
x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x

i will then load that into an array and use it to draw my map

thanks

PINO

Limit Lines Of Printing
hi need help on printing just a number of lines say 50 lines in a printer. i cant control the number of text to be printed since i only used printer.print textbox1.text.. thank you

Limit Multiline Txt Box To 30 Lines
I want to delete lines from a multiline textbox....
say limit it to 30 lines. Dont want to switch to a list
box.

Thanks

Long Text File To Excel Database - Row Limit
Hi guys,

I am currently experiencing a problem opening a text file which has the following data in it.
1) X co-ordinates in the first half
2) Y co-ordinates in the second half

I thought it would have been very easy to just copy and paste but seems like there is a Row Limit in Excel and i have too many points - 69041 to be exact ... so thats 69041 x 2 rows !

The Row Limit on Excel seems to be at 65536 ....

Its easy enough to just split the x co-ordinates in 2 as they are incrementing, but the y co-ordinates are all over the place so its hard to know where i left off !

And not only that i have to do the same thing to more than 40 text files with differing number of data points

So i was hoping to write a VB macro to
1) simply count how many rows there are in total
2) Divide it in two and process it so its in a column format
ie from
1
2
3
4
2
2.1
-1
10

to
X Y
1 2
2 2.1
3 -1
4 10

3) to divide them in 2 or 3 or 4 more columns depending how many rows there are (as it cant go above 65536)
4) and then finally to convert it into an Excel file.

I am so far out of my depth since I have no idea what I'm doing I will include a sample of the text document that im trying to convert

I'd appreciate any help you guys can give me

Cheers !

Line Length Of Text File
Dear all,

I tried to create text file which each line is 1634 bytes. But created file only contains 1024 bytes and moves others to next line. Why?
The source code is as follow:

Open "c: est.txt" For Output As #1 Len=1634
Print #1, string(1634, "*"
Close #1

Help With Fixed Length Text File
Hi ....

I need somebody to help me, I have a fixed length text file which is getting captured from a telephone log system, I need to read this file and show them on form...let say I have the following text file:

aa b1234 6789cd 0002 abc <--------- the first line
aa b1234 6789cd 0002 abc <--------- the second line
aa b1234 6789cd 0002 abc <--------- the third line
aa b1234 6789cd 0002 abc <--------- the forth line


aa is data1 ,then b is data2 1234 is data 3 , cd is data 4, 000is data5 , 2 is data 6 etc..

reading this and making queiry on it such as if data4 is cd then or if data4 is ef then.....that will be helpful.


Thanks again for any one who could help me.

LIMIT Lines And Characters For Textbox
couldnt find any snippet to limit the lines/characters i type in a textbox, i need the textbox to have max 7 lines with 50 characters per line, anyone?

Textbox Limit # Of Lines ***** RESOLVED
Hi there!

I want to limit a multiline textbox to 5 lines, max 40 characters per line.

Can it be done??

Thanks in advance.

Get Length Of Several Lines
Sups,
I'm using this code to color specific words.
The code works well for the first line (Line# 0) but for the rest of the lines the code is missing the SelStart of the word.

VB Code:
Private Sub ScriptText_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then 'Enter    LinesString = Split(ScriptText.Text, vbCrLf) 'Get the string for each line    CurrentLine = SendMessage(ScriptText.hwnd, EM_LINEFROMCHAR, ScriptText.SelStart, 0&) 'Get the currentline    Call FindTags(LinesString(CurrentLine), "End")End IfEnd Sub Public Function FindTags(sLine As String, Tag As String) As StringIf InStr(1, sLine, Tag, vbTextCompare) Then 'Find "End" in string    Call ChangeColor(sLine, Tag)End IfEnd Function Public Sub ChangeColor(sLine As String, Tag As String)Dim Pos As LongDim StrLen As Long'This part is to get the length of all the lines untill the currentlineIf CurrentLine <> 0 Then    StrLen = 0    For i = 0 To CurrentLine        If i <> CurrentLine Then            StrLen = StrLen + Len(LinesString(i)) + 2 '3 lines        Else            StrLen = StrLen + Len(LinesString(i))        End If    Next i    MsgBox StrLenEnd If'Color the wordFor i = 1 To Len(sLine)    Pos = InStr(i, sLine, Tag, vbTextCompare)    If Pos > 0 Then        With Form1.ScriptText            If CurrentLine = 0 Then                .SelStart = Pos - 1            Else                .SelStart = StrLen - (Pos - 1)            End If            .SelLength = Len(Tag)            .SelColor = vbRed '&H800000            .SelStart = Len(.Text)            .SelColor = vbBlack        End With        i = Pos    End IfNext iEnd Sub
The problem in this code is that i cant find out how to get the length of all the lines including the current line which is being edited.
I found out that after each line there is a chat (probebly vbCrLf)
But it seems like i'm missing something.
can ne1 help me?
tnx in advance!

Open A Text File And Count The Lines In Text File
Does anybody have any good vb code that would allow me to open a file count the lines in the file (or search for a certain character and do a count of that character) close the file and then compare it to a variable count. if the count is the same then continue, if the file is not the same delete the file and exit or abort the program.

example the lines I need to count start with 100000.

So i have a count of what is being pulled from the database of 60. I want to see if a file exists, if the file exists I want to do a count of all the lines starting with 100000. and compare it to 60 if the count is = 60 then finish, if it is not 60 then error out.

thanks!!!!

Insert Multiple Lines Of Text Into An Email From A Text File
Hi All,

I am looking for a way to read multiple lines from a text file anything upto 100 and then insert those into the body of an email message.

I can send the email as I know how to do that it just the reading of the text and then puttiong it into the email that I have a problem with.

Any idea's,

Regards,

Oz

Length Of Sequential Access (text) File
Anyone want to give me a quick way to find the length (in lines) of these types of files?

Thanks!!!!

Importing Fixed Length Text File Into SQL
HELLLP!
I have this table in my SQL db that has 571 columns. The data is in a text file that has fixed length fields, no delimiters.

I've tried three times to do the import using the wizard and keep missing one or two lines (to set the columns) and I end up with 569 columns or 570.

It takes me at least 45 minutes to do this each time and I'd like to try and speed things up as I have several similar text files to import.

I want to do something in vba (access) as I have a project set up with direct connection to the sql server and I know how to connect and do inserts and what not.

My problem is parsing out the lines in the text file. I have another table that specifies column name and length (that's what I used to create the big table).

How could I use that to write some code to parse through the text file?

I know how to do the inserts and loops and what not, it's just the parsing part, ie. how to access the text file, tell it where to start and stop for each column, that I don't understand.

Any help would be greatly appreciated.

And one more thing, now that I found this place I'll see if I can't help out a little too!

Upper And Lower Limit Lines On Charts
Visual basic 6.0 with Excel 2000

I have a chart whose y-axis runs from 2.2 to 3.2 with a minor tick every 0.2.

The x-axis runs from 105 to 135.

The chart is generated through a macro.

Is it possible, using the macro, to draw a solid line from x=105 to x=135 at certain values of y. That is draw lines that represent upper and lower limits.

I know that they can be added on manually, but was wondering if could be done automatically.

Thanks

Limit Textbox To A Specific Number Of Lines
I set a textbox to multiline and further, I need these

1. Multiline textbox wraps the text. Instead I need to insert vbCrLf characters at the end of each line if user did not insert it pressing return manually. So I need to check each line if it has a vbCrLf at the end and place one if missing (Cause I will save the textbox content to a file and I need a delimiter for the lines to be able to pick and read a unique line from the file)

2. I need to limit the line number to 11as maximum. I can do it
counting vbCrLf if I can solve question Nr:1 though.

I can also use any other approach as basically I need to save 11 lines of textbox to a text file and be able to read any given line back.

Thanks for any help.

Fixed Length Text File With Write # Statement
Need to output a recordset in a fixed length format to a text file using the Print# or Write# statement.

This is what I have so far but when the field is longer than what the tab allows it writes it on the next line instead of forcing it on the same line (or writing over the existing field) Please Help!!



Open "test3.txt" For Output As #1

While Not rs.EOF

Print #1, Tab(0); rs.Fields("Ship_To_ID"); Tab(14); rs.Fields("Ship_To_Name"); Tab(39); rs.Fields("Ship_To_Address_1");
Print #1, Tab(64); rs.Fields("Ship_To_City");



rs.MoveNext
Wend
Close #1

Upload Data I.e Fixed Length From Text File........
Hi All,
I am using VB6.0 and Access 97
I need to upload data from text file.
The text file dontains fixed length characters.
Ex:
0212130202010003 400.00 11 2 16287 201
0212130202010005 754.00 11 2 16287 201
0212130550020005 222.00 25 5 11448 5002

I am trying to use Split function........
sCama=""
MAX_COLUMN_INDEX =6
FileLength = FileLen("\Deposit Program" & FileExist)
       If (FileLength > 0) Then
           ConnectiondbOpen
             Open "\Deposit Program" & FileExist For Binary Access Read Lock Read As #FileNo
           sTemp = Space(FileLength)
         Get #FileNo, , sTemp
         Close #FileNo

         ' Split data into constituent rows
         strData = Split(sTemp, vbCrLf)
         For lngRow = 0 To UBound(strData)
            ' Split row into constituent columns
            strItem = Split(strData(lngRow), sCama, , vbTextCompare)
             If UBound(strItem) = MAX_COLUMN_INDEX Then 'The problem is here
                sDLN = strItem(0)
                cAmount = CCur(strItem(1))
                iNumChecks = CInt(strItem(2))
                byScanner = CByte(strItem(3))
                ..........................
                ...........................

It is not recognizing columns. And i don't know how to specify the seperator for fixed length strings.
[It's easy to specify , Or ; Or Tab]
Can somebody help me in specifying the seperator........
Thanks
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>







Edited by - sreddy on 3/3/2006 7:01:51 AM

Import Text File Using Fixed Length Delimeter
Hi All,
I was working on import text files to an flexigrid,
i have to provide the same way as in excel report i was able to import based on delimeters but when the fixed lengthdelimeter comes to picture i am finding it difficult expecting for immediate response from you friends.
It will be very much usefull the import using fixed delimeter is same as in Excel or if we use the import option in excel from VB application

Export A Fixed Length Text File To Comma Delimited
Hi all

Does anyone know how to exprt a fixed length text file to comma delimited text file. I know that u have to check for characters in the text file , but i wouldnt even know how to do this .

Please can someone help

thanks

Make Every Page 20 Lines Total Length
I'm trying to figure out how to read through a multipage text file for
a specific string (always in the first 3 columns of a line), then and
add X number of blank lines to make the total page length 20 lines.
There are always 7 lines of text after the string is found. These
lines need to stay at the bottom of each page.

For example, every time I see the numbers "037", add enough blank
lines to make the total lines of that page = 20

Here a sample file, it is 11 lines long:
***********************************
033 apple asdlksdlkfdkfjlskfjlfs
pear slkdjflksdflkjdfjlksf
grape alskdfsdfdf
orange asdfasdf
037 banana asldkfjasdlk
lkasjdfljka
asdfasdf
asdfasdf
asdfasdf
ksjflkdlj
ljkisdlfkdlfk
**********************************

After running a vb script, the file should look like this and must be
20 lines long:

**********************************
033 apple asdlksdlkfdkfjlskfjlfs
pear slkdjflksdflkjdfjlksf
grape alskdfsdfdf
orange asdfasdf
037 banana asldkfjasdlk
'
'
'
'
'
'
'
'
'
lkasjdfljka
asdfasdf
asdfasdf
asdfasdf
ksjflkdlj
ljkisdlfkdlfk
**********************************

I was thinking of something like this:

1. count number of lines = x
2. 20 - x = YlinesToAdd
3. Find "037:
4. Insert blanklines Y times.

Any ideas or pieces of code to do this?

Thanks!

Lines In Text File
I'm not sure if I should be posting this here but I figured someone here would know this.

Are the # of lines in a text file limited by memory space or a numeric value.

Thanks

Lines In A Text File
Im making a program for learning [Pronomen] for german words:

Der Baum
etc....

I want to display a label that says how many questions (lines) there are in the file #1 and then how can I add a limit to how many lines it can read in?

Can u give me some help please?

How Do I Add Lines To A Text File?
Hi guyz.

I wanted to add lines to a text file but what i do results to replacing the all the lines in the file. Plese help! Thanx!

Lines From A Text File
I need help with VB, I know almost nothing and I am trying to write a very simple program.
Heres the problem, I need to know how to get line 46 from a text file called "dat.txt". Thats my whole program... Please help me....

Lines In Text File
Can I just know some how the no of lines in a text file? It's aim is to set the max value for a progress bar while importing.Thanks in Advance

Lines In Text File
is there any simple way to get the number of lines in a text file?
i know i can loop until eof(1) = true but is the any other way?

Get # Of Lines In Text File
I create a text file using the File System Object and add lines to it by using this example:

txtkill.Write ("john sucks") ' Write a line.
txtkill.WriteBlankLines (1)
txtkill.Write ("real bad") ' Write a line.
txtkill.Close

I need to add to this file some lines from another text file, is there any easy way to count the number of lines in the text file?

# Of Lines In A Text File
How do I get the number of lines in a text file?

No Of Lines In Text File
Is there a function in VB to tell me how many lines is in a text file? I want to display an accurate progress bar while importing large text files. I've tried using a combination of LOF() and Loc(), but Loc doesn't return an appropriate value.

Thanx!!

Delete Lines From Text File
Hello,

Using VB6, I want to open a text file, search lines that contain a specified string & delete the line if the string is found. Main problem is, I do not know what command to use to delete the line. Help is very much appreciated.


Regards,
Me

How To Read Different Lines Of A Text File?
I'm sure this is an easy enough question to answer but I wasn't able to find any threads about it so my apolgies if it has already been answered.

Basically what I need to do is read different lines of a text file depending on a random number for example on a number of 4 it will read line 4 of the text file. I am aware how to read the first line of a text file with

Open ("C: est.txt") For Input As 1
Line Input #1, strTest
Text1.Text = strTest
Close #1

however I am unaware on how to read any other lines.

Any help is greatly apprecitated thanks in advance

Write A Text (many Lines) In A File
Hi

I m facing a problem: if I write to a file, I need to do it line after line, if I copy paste a text, and do as follows, I can t even compile. How can I do?


Code:
Open BuildDirectory + "" + BuildName + ".html" For Output As #1
Write #1, "<html> _
<head/> _
<body> _
HELLO _
</body> _
</html>"

Close #1

thanks a lot

Number Of Lines In A Text File
is there any easy way of finding out how many lines a text file has in VB, ive know a very innefficient way, but would like to know what simpler means there is to achieve the same result:

Code:
Dim Subj ' just holds each line at a time
Dim SubjStr() As String ' the array which will be redimmed later to the right size..
Dim temp As String ' just a temporary thing..
Dim LineCount As Integer 'self explanatory
Dim n As Integer

Subj = FreeFile()

Open "I:ackupsMy DocumentsCollege StuffComputingVisual BasicNaminatorsubj.ini" For Input As #Subj
LineCount = -1
Do While Not EOF(Subj)
LineCount = LineCount + 1
Line Input #Subj, temp ' ***
Loop
Close #Subj

ReDim SubjStr(LineCount) ' make an array the size of the document...

Open "I:ackupsMy DocumentsCollege StuffComputingVisual BasicNaminatorsubj.ini" For Input As #Subj
For n = 0 To LineCount
Line Input #Subj, SubjStr(n)
Next n
Close #Subj

For n = 0 To LineCount
Print n & " " & SubjStr(n)
Next n
*** I would like to know if there is a way to reset this, as this always goes onto the next line right? this would mean i wouldnt have to close and open the txt file again..

the reason i cant just add the lines directly to the array is becuase i want the array to be the same size as the amount of lines in the document (which is not constant..)


ive only been doing VB for a month or two now, this is my first app that uses any kind of IO..

Overwriting The Lines In Text File
Hi There,

Below source code is creating the text file without problem. But it is overwriting the Data from above lines. Because the first Detail tables are having more field than the trailer table. Let me know how to avoid this???

Here is the code :

Function ExportFileToLoannet(sFileName As String)
'--
'Form Level Function
'Write data into a fixed length ASCII file
'--

Dim sSQL As String
Dim adoRS As ADODB.Recordset
Dim iCount As Long
Dim cmdCommand As ADODB.Command
Dim sOutputFile As String
Static bIsFileCreated As Boolean
Dim ifHandler As Integer
''Dim sFile As String * 250
Dim sCreateFileName As String
Dim Header As Variant
Dim X As String
On Error GoTo errExport
Me.MousePointer = vbHourglass


'--get a handler
ifHandler = FreeFile

'--get a filename
''sFileName = sGetFileNameLexis

sCreatedFileName = sFileName

'--create the file first
Open sFileName For Output As ifHandler
bIsFileCreated = True
'--Header Format


sSQL2 = "SELECT * FROM tbl_detail_96537"

Set adoRS2 = ExecuteSQL(sSQL2, sText, iSybase)

If adoRS2.BOF Or adoRS2.EOF Then
MsgBox "No Detail records found"
Me.MousePointer = vbNormal
Exit Function
End If

With adoRS2
Do While Not .EOF

Mid(sFile, 1, 1) = Trim$(.Fields![det965_record_type])
'--VENDOR NAME
Mid(sFile, 2, 5) = Trim$(.Fields![det965_client_id])
'--INVOICE_NUMBER
Mid(sFile, 6, 14) = Trim$(.Fields![det965_cusip])
'--INVOICE_DATE
Mid(sFile, 15, 18) = Trim$(.Fields![det965_routing_table_id])
'--INVOICE_AMOUNT
Mid(sFile, 19, 27) = Trim$(.Fields![det965_quantity])
'--APPROVED
Mid(sFile, 28, 28) = Trim$(.Fields![det965_collateral_code])
'--CHECK_DATE
Mid(sFile, 29, 48) = Trim$(.Fields![det965_comments])

Mid(sFile, 49, 53) = Format(.Fields![det965_min_rebate_rate], "#####")
'--VENDOR NAMEFormat(CStr(-CDbl(Mid(Data, 2, Len(Data) - 2))), "###,###,###,###,##0.00")
Mid(sFile, 54, 54) = Trim$(.Fields![det965_min_rebate_rate_code])
'--INVOICE_NUMBER
Mid(sFile, 55, 63) = Trim$(.Fields![det965_min_partial_quantity])
'--INVOICE_DATE
Mid(sFile, 64, 71) = Format(.Fields![det965_max_price], "########")
'--INVOICE_AMOUNT
Mid(sFile, 72, 75) = Trim$(.Fields![det965_time_out])
'--APPROVED
Mid(sFile, 76, 76) = Trim$(.Fields![det965_loanet_indicator_code])
'--CHECK_DATE
Mid(sFile, 77, 77) = Trim$(.Fields![det965_batch_code])

Mid(sFile, 78, 78) = Trim$(.Fields![det965_profit_center])
'--VENDOR NAME
Mid(sFile, 79, 79) = Trim$(.Fields![det965_mark_parameter_type])
'--INVOICE_NUMBER
Mid(sFile, 80, 81) = Trim$(.Fields![det965_mark_parameter_amount])
'--INVOICE_DATE
Mid(sFile, 82, 82) = Trim$(.Fields![det965_tracking_indicator])
'--INVOICE_AMOUNT
Mid(sFile, 83, 88) = Format(.Fields![det965_dividend_flow_thru], "######")
'--APPROVED
Mid(sFile, 89, 100) = Trim$(.Fields![det965_blank])
Print #ifHandler, sFile
.MoveNext

Loop
End With

sSQL3 = "SELECT * FROM tbl_trailer_96537"

Set adoRS3 = ExecuteSQL(sSQL3, sText, iSybase)

If adoRS3.BOF Or adoRS3.EOF Then
MsgBox "No Trailer record found"
Me.MousePointer = vbNormal
Exit Function
End If
With adoRS3
Do While Not .EOF
'--CHECK_DATE
Mid(sFile, 1, 1) = Trim$(.Fields![tlr965_record_type])
Mid(sFile, 2, 6) = Trim$(.Fields![tlr965_count])
Mid(sFile, 7, 22) = Trim$(.Fields![tlr965_total_qty])
Mid(sFile, 23, 100) = Trim$(.Fields![hdr965_blank_2])
Print #ifHandler, sFile
.MoveNext
'''
'''''''' Mid(sFile, 125, 10) = Format(.Fields![PAY_AMOUNT], "######.00")

Loop
End With


Close 1
MsgBox _
Prompt:="File Created Successfully", _
Buttons:=vbOKOnly, _
Title:="Export"

Me.MousePointer = vbNormal
ShellAndLoop sBatchFileName, vbNormalFocus

Exit Function
errExport:
If bStopProcess Then
Close
Else
MsgBox Err.description, vbCritical
bStopProcess = True
Me.MousePointer = vbNormal

End If

End Function


Thanks
Ekta

Copyright © 2005-08 www.BigResource.com, All rights reserved