Dec 13th, 1999, 08:36 PM
i have two tables : one is a header and the other is for line items.
in both the header and line item table is a field called "ORDER_NO" and
both have corresponding numbers.
(i.e. in the header can be a 2
and in the line items can be several 2's that hold all of the order's
items for that particular order.)
i am trying to assign order numbers to replace the 2,3,4, etc in both
the header and the line items tables.
i am successfull with the following code, however ,when the last of the
2,3,4,etc is reached, i get the "No current record"(3021) error.
Can someone please help me solve this error from creeping up?
Thanks in advance.
'rs1 is the header table and rs3 is the line items table
'MaxNum is the number of records counted in the header table.
'OrdNum is the order number assigned (number received from
'a previous operation).
' i is a placeholder that holds the 2, 3, 4, etc and is incremented
' and then is replaced with the order number.
'assign order numbers to the orders
rs1.MoveFirst
For i = 1 To MaxNum
i = rs1.Fields("ORDER_NO")
rs1.Edit
rs1.Fields("ORDER_NO") = OrdNum
rs1.Update
rs1.MoveNext
While rs3.Fields("ORDER_NO") = i
rs3.Edit
rs3.Fields("ORDER_NO") = OrdNum
rs3.Update
rs3.MoveNext
Wend
OrdNum = OrdNum + 1
Next
in both the header and line item table is a field called "ORDER_NO" and
both have corresponding numbers.
(i.e. in the header can be a 2
and in the line items can be several 2's that hold all of the order's
items for that particular order.)
i am trying to assign order numbers to replace the 2,3,4, etc in both
the header and the line items tables.
i am successfull with the following code, however ,when the last of the
2,3,4,etc is reached, i get the "No current record"(3021) error.
Can someone please help me solve this error from creeping up?
Thanks in advance.
'rs1 is the header table and rs3 is the line items table
'MaxNum is the number of records counted in the header table.
'OrdNum is the order number assigned (number received from
'a previous operation).
' i is a placeholder that holds the 2, 3, 4, etc and is incremented
' and then is replaced with the order number.
'assign order numbers to the orders
rs1.MoveFirst
For i = 1 To MaxNum
i = rs1.Fields("ORDER_NO")
rs1.Edit
rs1.Fields("ORDER_NO") = OrdNum
rs1.Update
rs1.MoveNext
While rs3.Fields("ORDER_NO") = i
rs3.Edit
rs3.Fields("ORDER_NO") = OrdNum
rs3.Update
rs3.MoveNext
Wend
OrdNum = OrdNum + 1
Next