?
Solved

Reading from a sequential file!!!

Posted on 1998-11-12
8
Medium Priority
?
228 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 300 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

741 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