Solved

how to modify a line of data

Posted on 2002-04-29
2
145 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 100

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

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

751 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