I have a text file with items such as this:
1001
1002
1004
D1001
D1002
D1004
G1001
G1002
G1008
The number of lines in this file can potentially go to 10,000. I can already parse out the different ID's, no letter or different letters. My goal is to take this parsed data and search for missing increments.
Because text files don't lend themselves to random access, I want to load these into a random file. I could then drop the letter, change the string to a integer, add 1 to it and compare it to the second number. If equal compare the second to the third etc. etc. Once I get a <> condition change it back to a string, add the letter back and save it to a text box.
Here is a test piece of code that errors on the Put command.
I defined this type in a module then when I try to run the code below it errors out on the Put statement.
Public Type Product
ProdID As String
End Type
Dim rProdFile As Product
Dim iTest As Integer
iTest = 0
Open "C:\VSS\ProdID.txt" For Input As #8
Open "C:\Product ID\Test.dat" For Random As #9 Len = Len(rProdFile)
While Not EOF(8)
iTest = iTest + 1
sCheck = Input(6, #8)
rProdFile.ProdID = sCheck
MsgBox sCheck, rProdFile.ProdID
Put #9, iTest, rProdFile
MsgBox "Record ", iTest, "Product ", rProdFile.ProdID
Wend
Looks so simple I am missing it. I have tried defining the sCheck as a string and as a string * 6. I have also done the same with the ProdID. I was thinking there may have been a CRLF issue. The data must not jive I guess.
BTW, I use to recreational program in Pascal and I am trying to learn VB6. Got a small project I am doing and then on to a mid-size that will include using access. Then maybe a real big one if I feel energetic.
Thanks for the help.
Joeb1
1001
1002
1004
D1001
D1002
D1004
G1001
G1002
G1008
The number of lines in this file can potentially go to 10,000. I can already parse out the different ID's, no letter or different letters. My goal is to take this parsed data and search for missing increments.
Because text files don't lend themselves to random access, I want to load these into a random file. I could then drop the letter, change the string to a integer, add 1 to it and compare it to the second number. If equal compare the second to the third etc. etc. Once I get a <> condition change it back to a string, add the letter back and save it to a text box.
Here is a test piece of code that errors on the Put command.
I defined this type in a module then when I try to run the code below it errors out on the Put statement.
Public Type Product
ProdID As String
End Type
Dim rProdFile As Product
Dim iTest As Integer
iTest = 0
Open "C:\VSS\ProdID.txt" For Input As #8
Open "C:\Product ID\Test.dat" For Random As #9 Len = Len(rProdFile)
While Not EOF(8)
iTest = iTest + 1
sCheck = Input(6, #8)
rProdFile.ProdID = sCheck
MsgBox sCheck, rProdFile.ProdID
Put #9, iTest, rProdFile
MsgBox "Record ", iTest, "Product ", rProdFile.ProdID
Wend
Looks so simple I am missing it. I have tried defining the sCheck as a string and as a string * 6. I have also done the same with the ProdID. I was thinking there may have been a CRLF issue. The data must not jive I guess.
BTW, I use to recreational program in Pascal and I am trying to learn VB6. Got a small project I am doing and then on to a mid-size that will include using access. Then maybe a real big one if I feel energetic.
Thanks for the help.
Joeb1