Solved

Read all records

Posted on 1998-09-02
4
154 Views
Last Modified: 2010-08-05
I have opened a file for random.  I have defined the record structure.  I am doing some manipulations on some of the fields in each record.  I am using GET (procedure) Put.  The problem I am having is getting the program to read each record and perform the manipulation on each record in the file.  I have tried using a variable for the[recnumber]  part  of GET and PUTand putting the file in a loop.  This does not work.  There has to be an easy way to do this.  Any Suggestions?
0
Comment
Question by:LJ083198
[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
  • 2
4 Comments
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1432640
Hi,

Are you using MSaccess?

If not, Use it if you can.

Tell me about it.
0
 

Author Comment

by:LJ083198
ID: 1432641
No I am not using MS Access.  The file is a flat file.    I used Access to create the file in the format that I wanted , but needed to do to much to it to continue in access.  The records are still in a table in Access in the correct layout.  I could import the table and then...???

It seems like such a simple thing that I want to do, I thought maybe I had overlooked a magic command????
0
 

Author Comment

by:LJ083198
ID: 1432642
If at all possible, I would like to update the records in VB and not in Access.  
0
 
LVL 2

Accepted Solution

by:
dabellei earned 20 total points
ID: 1432643
You're using ACCESS to create the text file and then you want to retrieve it and use it in ACCESS?

If it's that why don't you use directly ACCESS instead?

If not give us a sample of the text file and what's the output you're looking at?

Using a text file is very simple the best way i use is open the file with input mode wich will read one line at the time and then you could do anything you want this line.

In my example i read a line and then extract the domain of a user and then the name of the user.  Each line are different lenght but this does'nt affect the reading as each line is read one by one.

Hope this will be useful,  if you need anything else write me

progiclip@netc.net

or  daniel.belle-isle@bellsygma.com
    nfic = 1
    nfic2 = 2
    Dim texte_reper As String
            Open App.Path + "\group.txt" For Input As nfic
            Open App.Path + "\groupc.txt" For Binary Access Write As nfic2
            Do While Not EOF(nfic)
                Line Input #nfic, texte_reper
                If Trim$(texte_reper) <> "" Then
                    texte1 = Trim$(Mid$(texte_reper, 1, InStr(texte_reper, "   ")))
                    texte2 = LTrim(Mid$(texte_reper, InStr(texte_reper, "   ")))
                   
                    If InStr(texte2, "\") > 0 Then
                        domain = Mid$(texte2, 1, InStr(texte2, "\") - 1)
                    Else
                        domain = ""
                    End If
                    users = Trim$(Mid$(texte2, InStr(texte2, "\") + 1, InStr(texte2, "  ") - 1))
                    droits = LTrim(Mid$(texte2, InStr(texte2, "   ")))
                   
                    If texte1 <> "" Then
                        ligne$ = Chr(13) & Chr(10)
                        Put #2, , ligne$
                        t1$ = texte1 & Chr(13) & Chr(10)
                        Put #2, , t1$
                    End If
                    t2$ = texte2 & Chr(13) & Chr(10)
                    Put #2, , t2$
                End If
               
            Loop
            Close nfic
            Close nfic2


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

734 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