Solved

Reading from a sequential file!!!

Posted on 1998-11-12
8
221 Views
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.  
Thanks,
            kami
0
Comment
Question by:kmsadr
8 Comments
 

Expert Comment

by:Badder
ID: 1444538
Ok, i'll try it.
badderp@hotmail.com
0
 

Expert Comment

by:Badder
ID: 1444539
Ok, i'll try it.
badderp@hotmail.com
0
 

Expert Comment

by:Badder
ID: 1444540
Darn!
Sorry, I was just supposed to send a comment, I made a mistake and I didn't stop at time...
Sorry...
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:kmsadr
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,
Kami
0
 
LVL 2

Expert Comment

by:dm_14
ID: 1444542
send me your code and I will try to help
0
 
LVL 2

Expert Comment

by:dm_14
ID: 1444543
I can be reached at dm_14@hotmail.com
0
 
LVL 3

Expert Comment

by:Stefaan
ID: 1444544
If you want, I could take a look at it too.  E-Mail me at : lesages@my-dejanews.com
0
 
LVL 2

Accepted Solution

by:
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)
    Wend
    Close iFnum

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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