Need help with a Do loop containing EOF

Brad_512

Registered User.
Local time
Today, 17:07
Joined
Jun 16, 2006
Messages
19
I'm having a problem with my form where everytime I try importing a file into my database, I received an "overflow" message. It appears the problem is somewhere in my Do loop. The following shows what my code looks like right now:

Open txtCSVFileToUse For Input As #1
lvRandNum = Int((1000000 * Rnd) + 1)
lvINTERNAL_ID = lvRandNum
lpCntr = 1
Do While Not (EOF(1))

If lpCntr = 1 Then lpCntr = lpCntr + 1


Input #1, csvPro, csvJobName, csvJobNumber, csvShipper, csvConsignee, csvBillTo, csvServiceCode, csvCopies, csvWeight, csvUniqueContainerID, csvManifest, csvDueDate, csvTareWt, csvClass, csvVersion
With objRS
.AddNew
.Fields("K95_ID") = lvINTERNAL_ID
.Fields("K95_INTERNAL_ID") = lvINTERNAL_ID




.Fields("K95_PRONUM") = csvPro
.Fields("K95_JOBNAME_VERSION") = csvJobName
.Fields("K95_JOBID_MOTHER_PALLET") = csvJobNumber
.Fields("K95_SHIPPER") = csvShipper
.Fields("K95_CONSIGNEE") = csvConsignee
.Fields("K95_BILL_TO") = csvBillTo
.Fields("K95_TARIFF") = csvServiceCode
.Fields("K95_NUMBER_OF_COPIES") = csvCopies
.Fields("K95_WEIGHT") = csvWeight
.Fields("K95_UNIQUECONTAINERID_MPAL") = csvUniqueContainerID
.Fields("K95_MANIFESTNUM") = csvManifest
.Fields("K95_DUE_DATE") = csvDueDate
.Fields("K95_TARE_WT") = csvTareWt
.Fields("K95_CLASS") = csvClass
.Fields("K95_VERSION") = csvVersion
If EOF(1) = True Then Exit Do
lpCntr = lpCntr + 1
End With
SkipLine:
lpCntr = lpCntr + 1
Loop


I'm thinking it has something to do with with my counter and/or my EOF stuff. Any help would be much appreciated.
 
It might have something to do with never issuing a .Update at the end of the .AddNew code.
 
.Update

I tried your suggestion and added the .Update at the end of the .Addnew fields. It didn't work with the way I put in the .Update. I might've added it in incorrectly ( I don't know). Do you think it might have have something to do with the way I set my lvINTERNAL_ID? It might be causing an overflow because I'm duplicating the same variable over and over.
 
Overflow usually means trying to put too big a number in too small a variable. Like 33,000 into an integer.
 

Users who are viewing this thread

Back
Top Bottom