PSUIVERSON
Technical User
I need to take a large table and based on one of the fields DEPT - I am filtering and then outputting to a .txt file. Right now I have roughly 35 departments. All BUT ONE are numeric department numbers. The final one is "L10". When I run this all of the departments are written to until it hits "L10" in which case I receive an error message
"RUN TIME ERROR 3001 - Arguments are of the wrong type, out of acceptable range or are in conflict with one another."
It always stops on "L10" so I am assuming that because of the "L" I am getting thrown here. But it's not a type mismatch error so I am confused. Does the filter method not accept non-numeric values?
Anyone experience this before? Thanks...
FYI - Here is the code [Note: rst2 is simply a table with one field that contains all the DEPT Numbers I am filtering]
...
rst.MoveFirst
rst2.MoveFirst
Do While Not rst2.EOF
DEPTNO = rst2.Fields(0)
rst.Filter = "CDEPT=" & DEPTNO
Do While Not rst.EOF
'Simply change to the F: Drive when needed for SOM
Open "c:\download\Dept_TEST\" & DEPTNO & "\PDPTMAST.txt" For Append As #1
i = 0
For Each fld In rst.Fields
If IsNull(rst.Fields(i)) Then
rst.Fields(i) = " "
End If
fldValue(i) = rst.Fields(i)
Write #1, fldValue(i),
i = i + 1
Next
rst.MoveNext
Write #1, "NULL"
Close #1
Loop
rst2.MoveNext
Loop
...
"RUN TIME ERROR 3001 - Arguments are of the wrong type, out of acceptable range or are in conflict with one another."
It always stops on "L10" so I am assuming that because of the "L" I am getting thrown here. But it's not a type mismatch error so I am confused. Does the filter method not accept non-numeric values?
Anyone experience this before? Thanks...
FYI - Here is the code [Note: rst2 is simply a table with one field that contains all the DEPT Numbers I am filtering]
...
rst.MoveFirst
rst2.MoveFirst
Do While Not rst2.EOF
DEPTNO = rst2.Fields(0)
rst.Filter = "CDEPT=" & DEPTNO
Do While Not rst.EOF
'Simply change to the F: Drive when needed for SOM
Open "c:\download\Dept_TEST\" & DEPTNO & "\PDPTMAST.txt" For Append As #1
i = 0
For Each fld In rst.Fields
If IsNull(rst.Fields(i)) Then
rst.Fields(i) = " "
End If
fldValue(i) = rst.Fields(i)
Write #1, fldValue(i),
i = i + 1
Next
rst.MoveNext
Write #1, "NULL"
Close #1
Loop
rst2.MoveNext
Loop
...