Solved

Read all records

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
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…

707 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

16 Experts available now in Live!

Get 1:1 Help Now