Solved

Read all records

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now