Hi to All
I hace a data file containing just 3 Numbers.
something like
1 2 3(1 space between Numbers(all positive))
The file has to stop at the end of the third Number(no spaces or newline vhars after that).
I read the file from a Form I have build in Access,
I change the values of these numbers I I put them back to the File(a text file.
I wrote the following piece of code in VBA which I attached to the click event on a DONE Button on the form to do this:
(I'm A Newbie...)
Dim FileNum As Integer
Dim K As String
Dim L As String
Dim M As String
FileNum = FreeFile()
Open "inputfile.txt" For Binary Access Write As FileNum
K = Format(Text0.Value) 'the value in textbox1
L = Str(Text2.Value) 'to leave a blank in front of Number
M = Str(Text4.Value) '....
Put #FileNum, , K
Put #FileNum, , L
Put #FileNum, , M
Close FileNum
The code seems to work , but If I write for example in the file the numbers 1 2 11, then read the file back in the form , change the numbers to 1 2 5, I get A file with numbers 1 2 51 , I know there is sth wrong in the way I write to to the file but I don't know what
Any ideas would be much Appreciated..
Nick
I hace a data file containing just 3 Numbers.
something like
1 2 3(1 space between Numbers(all positive))
The file has to stop at the end of the third Number(no spaces or newline vhars after that).
I read the file from a Form I have build in Access,
I change the values of these numbers I I put them back to the File(a text file.
I wrote the following piece of code in VBA which I attached to the click event on a DONE Button on the form to do this:
(I'm A Newbie...)
Dim FileNum As Integer
Dim K As String
Dim L As String
Dim M As String
FileNum = FreeFile()
Open "inputfile.txt" For Binary Access Write As FileNum
K = Format(Text0.Value) 'the value in textbox1
L = Str(Text2.Value) 'to leave a blank in front of Number
M = Str(Text4.Value) '....
Put #FileNum, , K
Put #FileNum, , L
Put #FileNum, , M
Close FileNum
The code seems to work , but If I write for example in the file the numbers 1 2 11, then read the file back in the form , change the numbers to 1 2 5, I get A file with numbers 1 2 51 , I know there is sth wrong in the way I write to to the file but I don't know what
Any ideas would be much Appreciated..
Nick