Solved

Read all records

Posted on 1998-09-02
4
152 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
  • 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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

778 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