Reading from a sequential file!!!

Posted on 1998-11-12
Last Modified: 2010-04-30
I have to read from a sequential file to diffrent fields and calculate the amount of new balance.I know I have to pares them and assign them to variables and then show them but I had some defficulty to do that.(I used as experment the first 10 text boxes as an array, to show the last names in the sequential file in these text boxes, but I couldn't)if anyone intersted in this question please send me a email and I send you my codes and what I did so far.  
Question by:kmsadr

Expert Comment

ID: 1444538
Ok, i'll try it.

Expert Comment

ID: 1444539
Ok, i'll try it.

Expert Comment

ID: 1444540
Sorry, I was just supposed to send a comment, I made a mistake and I didn't stop at time...
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.


Author Comment

ID: 1444541
It's been two days since you posted your proposed answer and I haven't heard from you. Please post the answer when you have a chance, thanks anyway,

Expert Comment

ID: 1444542
send me your code and I will try to help

Expert Comment

ID: 1444543
I can be reached at

Expert Comment

ID: 1444544
If you want, I could take a look at it too.  E-Mail me at :

Accepted Solution

dm_14 earned 150 total points
ID: 1444545
Paste this code in Balance.frm in Private Sub OpenmunItem_Click() just after you retrieve the file name from the common dialog.

' The Path to the file
Dim sPath As String
' Specify the location of the file
sPath = CommonDialog1.filename
' Array of First Names
ReDim sFName(1 To 1) As String
' Array of Last Names
ReDim sLName(1 To 1) As String
' Array of First Amounts
ReDim dAmount1(1 To 1) As Double
' Array of Second Amounts
ReDim dAmount2(1 To 1) As Double
' Array of Sum of First and Second Amount
ReDim dTotal(1 To 1) As Double
' Temporary line holder
Dim sLData As String
' Counter
Dim iCount As Integer

' Read Data from File
    iFnum = FreeFile
    Open (sPath) For Input As #iFnum
    While Not EOF(iFnum)
        iCount = iCount + 1
        ReDim Preserve sFName(1 To iCount)
        ReDim Preserve sLName(1 To iCount)
        ReDim Preserve dAmount1(1 To iCount)
        ReDim Preserve dAmount2(1 To iCount)
        ReDim Preserve dTotal(1 To iCount)
        Line Input #iFnum, sLData
        ' Save the First Name
        sFName(iCount) = Trim(Left$(sLData, 15))
        ' Save the Last Name
        sLName(iCount) = Trim(Mid$(sLData, 15, 16))
        ' Save the First Amount
        dAmount1(iCount) = CDbl(Trim(Mid$(sLData, 31, 10)))
        ' Save the Last Amount
        dAmount2(iCount) = CDbl(Trim(Mid$(sLData, 41, (Len(sLData) - 42))))
        ' Save the Sum of the first and second Amount
        dTotal(iCount) = dAmount1(iCount) + dAmount2(iCount)
    Close iFnum


Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to skip loop 6 57
Sending a email via excel using vba 6 82
How to compare ms sql hashbytes results within vb6 5 75
Macro Excel - Multiple If conditions 2 72
Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question