Solved

how to modify a line of data

Posted on 2002-04-29
2
147 Views
Last Modified: 2010-05-02
need help on the following code.


Private Sub Command1_Click()
X1% = 1
Do While X1% <= Max%
X1% = X1% + 1
Loop
Open "C:\invoice\dollar.dat" For Append As #3
    Form3.Text1.Text = inv  'invoice #
    Form3.Text2.Text = ddate  'date
    Form3.Text3.Text = amt  'amount
   
    Form3.Text4.Text = amt5  ' amt * 5%
    Form3.Text5.Text = deal  'dealer
    Form3.Text6.Text = paid

Do While X1% <= Max%
    Write #3, inv(X1%), ddate(X1%), amt(X1%), amt5(X1%), deal(X1%), paid(X1%)
    X1% = X1% + 1
    Loop
Close #3

End Sub


I want to change the one line of data to show that the invoice has been paid by entering a "y" oe "yes" into the "paid" area.....without changing ANY other data for this line (inv,ddate,amt,amt5,deal, paid) or any other data in the total file.
0
Comment
Question by:hjaycox
[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 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 6979317
Your code doesn't make muh sense.

Does the data have to end up in the same file?
The way you have this written you are opening the file at the end, never reading from it and then writing something back to it.

I think you need to look at how to read/write from a random access file.  I don't have any VB books here nor do I know how to do it.

The general algorithm will be

Open to file
loop
  read next record
  if it one you want to edit 'this will allow you to edit
    edit record               'multiple records
    backup one reocrd
    write the record
  endif
end loop

good luck
mlmcc
0
 
LVL 3

Accepted Solution

by:
n_narayanan earned 200 total points
ID: 6979605
You have to use Random files instead of Sequencial Access.

http://www.freevbcode.com/ShowCode.Asp?ID=2673
http://www.freevbcode.com/ShowCode.Asp?ID=315

Check the above links

Cheers

Narayanan
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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…
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…
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 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
Course of the Month8 days, 5 hours left to enroll

617 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