Solved

how to modify a line of data

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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 …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

856 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