(Sorry for the mistype in the title, should have been 'text', not taxt)
I'm trying to save information from text boxes to a text file that can be loaded later. The problem is that I need to save a 'spot' in the file, in case a text box in the middle gets filled later. Until this gets fixed, I get runtime error 5: Invalid procedure call or argument.
Code:Private Sub mnuFileSave_Click() 'Saves the customer's information '###Finished, but untested 'Check if file exists. If so, then overwrite. If not, make the file. If Dir(App.Path & "\Saved" & "\" & txtName.Text & " " & txtCar.Text & " " & txtDate.Text & ".txt") <> "" Then Open App.Path & "\Saved" & "\" & txtName.Text & " " & txtCar.Text & " " & txtDate.Text & ".txt" For Output As #1 Else: Open App.Path & "\Saved" & "\" & txtName.Text & " " & txtCar.Text & " " & txtDate.Text & ".txt" For Append As #1 End If Write #1, txtName.Text, txtAddress.Text, txtDate.Text, txtNumber.Text, txtCar.Text Dim cnt As Integer For cnt = 0 To 13Next cnt Write #1, Val(FormatNumber(txtPartsTotal(0).Text, 2)) For cnt = 0 To 3 Write #1, txtEst(cnt).Text, Val(FormatNumber(txtEstimate(cnt).Text, 2)) Next cnt Write #1, Val(FormatNumber(txtEstimateTotal.Text, 2)) For cnt = 0 To 9 Write #1, txtLabor(cnt).Text, Val(FormatNumber(txtLaborCost(cnt).Text, 2)) Next cnt Write #1, Val(FormatNumber(txtLaborTotal.Text)), Val(FormatNumber(txtPartsTotal(1).Text)), Val(FormatNumber(txtTotal.Text)) Close #1 End SubError here Code:
Write #1, Val(txtPartNo(cnt).Text), txtPartNum(cnt).Text, txtPartName(cnt).Text, Val(FormatNumber(txtPartPrice(cnt).Text, 2))




Reply With Quote