Solved

Reading from a sequential file!!!

Posted on 1998-11-12
8
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

717 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