J
Jesse Aviles
I have the following code:
Function ReadInventory()
'---------------------------------------------------------------------------------------
' Procedure : ReadInventory
' DateTime : 2005-06-19 20:44
' Author : Jesse Avilés
' Purpose : Read the scanning gun results and copy the data to a processing table
'---------------------------------------------------------------------------------------
'
Dim rst As ADODB.Recordset
Dim i As Integer
'Dim l As Long
Dim strFolder As String
Dim colGunData As Collection
Dim colProcessedOK As Collection
Dim objFS As FileSystemObject
Dim objTS As TextStream
On Error GoTo ErrorHandler
Set rst = New ADODB.Recordset
strFolder = GetProcLocation()
Set colGunData = New Collection
Set colProcessedOK = New Collection
FindFilesUsingAPI strFolder, colGunData
i = 1
' l = 1
rst.Open "tblConteoInventario", CurrentProject.Connection, adOpenDynamic, adLockPessimistic
For i = 1 To colGunData.Count
Set objFS = New FileSystemObject
Set objTS = objFS.OpenTextFile(colGunData.Item(i))
Do Until objTS.AtEndOfStream
rst.AddNew
Debug.Print "line: " & objTS.ReadLine
---------> rst("txtInventarioID") = objTS.ReadLine <----------------
rst.Update
objTS.SkipLine
Loop
colProcessedOK.Add colGunData.Item(i)
Next i
ExitHandler:
On Error Resume Next
rst.Close
Set rst = Nothing
Set colProcessedOK = Nothing
Set colGunData = Nothing
Exit Function
ErrorHandler:
MsgBox "Unexpected Error: " & Err.Number & vbNewLine & Err.Description & vbNewLine & "In
procedure ReadInventory of Module mdlGetFilesInfo"
Resume ExitHandler
End Function
This code breaks at the line marked -----> <-------
The error given is:
"Error -2147217887
The field is too small to accept the amount of data you attempted to add. Try inserting or
pasting less data."
The field is a text field with a lenght of 50 characters. The value that is supposed to be inserted
is 015000. There are still 44 spaces left unused. The debug.Print statement presented the above
value so I know that it is not trying to insert more than one value. I'm rather puzzled by this,
any help will be greatly appreciated.
Function ReadInventory()
'---------------------------------------------------------------------------------------
' Procedure : ReadInventory
' DateTime : 2005-06-19 20:44
' Author : Jesse Avilés
' Purpose : Read the scanning gun results and copy the data to a processing table
'---------------------------------------------------------------------------------------
'
Dim rst As ADODB.Recordset
Dim i As Integer
'Dim l As Long
Dim strFolder As String
Dim colGunData As Collection
Dim colProcessedOK As Collection
Dim objFS As FileSystemObject
Dim objTS As TextStream
On Error GoTo ErrorHandler
Set rst = New ADODB.Recordset
strFolder = GetProcLocation()
Set colGunData = New Collection
Set colProcessedOK = New Collection
FindFilesUsingAPI strFolder, colGunData
i = 1
' l = 1
rst.Open "tblConteoInventario", CurrentProject.Connection, adOpenDynamic, adLockPessimistic
For i = 1 To colGunData.Count
Set objFS = New FileSystemObject
Set objTS = objFS.OpenTextFile(colGunData.Item(i))
Do Until objTS.AtEndOfStream
rst.AddNew
Debug.Print "line: " & objTS.ReadLine
---------> rst("txtInventarioID") = objTS.ReadLine <----------------
rst.Update
objTS.SkipLine
Loop
colProcessedOK.Add colGunData.Item(i)
Next i
ExitHandler:
On Error Resume Next
rst.Close
Set rst = Nothing
Set colProcessedOK = Nothing
Set colGunData = Nothing
Exit Function
ErrorHandler:
MsgBox "Unexpected Error: " & Err.Number & vbNewLine & Err.Description & vbNewLine & "In
procedure ReadInventory of Module mdlGetFilesInfo"
Resume ExitHandler
End Function
This code breaks at the line marked -----> <-------
The error given is:
"Error -2147217887
The field is too small to accept the amount of data you attempted to add. Try inserting or
pasting less data."
The field is a text field with a lenght of 50 characters. The value that is supposed to be inserted
is 015000. There are still 44 spaces left unused. The debug.Print statement presented the above
value so I know that it is not trying to insert more than one value. I'm rather puzzled by this,
any help will be greatly appreciated.