?
Solved

Read all records

Posted on 1998-09-02
4
Medium Priority
?
157 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 60 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…
Suggested Courses

765 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