Solved

how to modify a line of data

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

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

Suggested Solutions

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 …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

864 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

20 Experts available now in Live!

Get 1:1 Help Now