R
R. Choate
I finally was able to save my recordset from AS400 to ADTG file (records.dat). There were 6 fields, one of which is numeric, and
that numeric field was a roadblock to saving the recordset. Somebody came up with digits(mynumericfield) as a solution, and it
worked. Now, I can see that records that have values of less than 5 digits (in my problem field), have leading zeros. For instance,
CUST = 945, is now CUST = 00945. I believe the table definition stated that my numeric field should be 5 digits. Anyway, now when I
try to re-open my new recordset and find a specific record, using the FIND method, I can't get FIND to work unless I use leading
zeros in my comparison. The field has values that vary from 3 digits to 5 digits. I need to be able to find the correct record,
where my CUST# = 1066 and my CHG field = "DF". I have tested the code below, successfully, by adding a leading zero to 1066 and
setting my FIND for only that string(ignoring CHG). CHG is a 2-character string field. Here is my current code, which fails at the
rst.Find line:
Sub CheckCust()
Dim X As String
Dim F As String
Dim J As String
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
rst.Open "H:\Subdirectory\myrecordset.dat", , adOpenStatic, adLockBatchOptimistic
X = "1066"
F = "DF"
rst.Find ("CUST = " & X & " And Chg = " & F)
J = rst!DESC
rst.Close
Set rst = Nothing
End Sub
that numeric field was a roadblock to saving the recordset. Somebody came up with digits(mynumericfield) as a solution, and it
worked. Now, I can see that records that have values of less than 5 digits (in my problem field), have leading zeros. For instance,
CUST = 945, is now CUST = 00945. I believe the table definition stated that my numeric field should be 5 digits. Anyway, now when I
try to re-open my new recordset and find a specific record, using the FIND method, I can't get FIND to work unless I use leading
zeros in my comparison. The field has values that vary from 3 digits to 5 digits. I need to be able to find the correct record,
where my CUST# = 1066 and my CHG field = "DF". I have tested the code below, successfully, by adding a leading zero to 1066 and
setting my FIND for only that string(ignoring CHG). CHG is a 2-character string field. Here is my current code, which fails at the
rst.Find line:
Sub CheckCust()
Dim X As String
Dim F As String
Dim J As String
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
rst.Open "H:\Subdirectory\myrecordset.dat", , adOpenStatic, adLockBatchOptimistic
X = "1066"
F = "DF"
rst.Find ("CUST = " & X & " And Chg = " & F)
J = rst!DESC
rst.Close
Set rst = Nothing
End Sub