Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with loading saved document!

Status
Not open for further replies.

WastinAway

Technical User
Jun 21, 2004
31
0
0
US
Everything is working properly in this program. Except It won't let me run the program unless I already have a $0.00 dollar amount entered in the saved file. How can I fix that? Here is my script! Thanks for everyone's help.



Private Sub Save_Click()

Open "Running Total" For Append As #1
Print #1, txttotal.Text
Close #1

Open "Running Total 2" For Append As #2
Print #2, txttotal2.Text
Close #2

End Sub

Private Sub form_load()

Dim RunTotal As Single
Dim RunTotal2 As Single
Dim a As String
Dim b As String



Open "Running Total" For Input As #1
Do Until EOF(1)
'' Read the line from the text file''
Line Input #1, a
'' Convert the read string into a currency, and add it to a running total ''
RunTotal = RunTotal + CCur(a)
Loop
Close #1
'' Put the running total into the appropriate text box ''
txtruntotal.Text = Format(RunTotal, "currency")



Open "Running Total 2" For Input As #2
Do Until EOF(2)
Line Input #2, b
RunTotal2 = RunTotal2 + CCur(b)
Loop
Close #2
txtruntotal2.Text = Format(RunTotal2, "Currency")



End Sub

 
Are you getting a file not found error? If so, you should trap for that and just put $0.00 in the text box.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
It won't let me run the save_Click() if the load_click() is in the script. I have to take out the Load_click() then run the program. It creates 2 files and then I have to go back and write the load_click(). BUt when I make the progrma Executable on say another PC. It won't work because I can't both sections written. How can I correct this! Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top