rcorrea
01-08-2004, 07:14 PM
I have a program that searches through a recordset for indexes to lines in an order.
The program worked fine until the owner re-indexed or rebuilt all the indexes. Basically all the pointers changed for these lines, and now my program is freakin out and saying it cant find data.
Heres the code that previously worked, and STILL works on some orders.
vb
Private Sub Command1_Click()
Set rstMyrecset = Nothing
Set Mas90 = Nothing
Do Until strNextline = 0
If Ordernumber <> strSalesorder Then
MsgBox Err.Source & "The order number has changed." & _
"This order is crosslinked." & Err.Description, , "Error"
GoTo error:
End If
cmdMyrecset.CommandText = "SELECT LineIndex, LinkToNextLine," & _
" SalesOrderNumber, LinkToPrevLine FROM SO2_SOEntryDetailLine WHERE" & _
"(LineIndex LIKE '%" & strNextline & "')"
Set rstMyrecset = cmdMyrecset.Execute
strLineindex = rstMyrecset.Fields.Item("LineIndex").Value
strPrevline = rstMyrecset.Fields.Item("LinkToPrevLine").Value
strNextline = rstMyrecset.Fields.Item("LinkToNextLine").Value
strSalesorder = rstMyrecset.Fields.Item("SalesOrderNumber").Value
txtLineindex.Text = strLineindex
txtPrevline.Text = strPrevline
txtNextline.Text = strNextline
txtOrdernumber.Text = strSalesorder
txtLineindex.Refresh
txtPrevline.Refresh
txtNextline.Refresh
txtOrdernumber.Refresh
'Sleep 1000
'DoEvents
'Open "c:\windows\desktop\mylog.txt" For Append As #1
'Print #1, "Previous Line "; strPrevline, "Next Line "; strNextline, "Line Index "; strLineindex
'Close #1
Loop
MsgBox "The order started at 00 and ended in 00, and the order number did " & _
"not change. Pre-checking can be notified this order is OK."
error:
txtLineindex.Text = 0
txtPrevline.Text = 0
txtNextline.Text = 0
txtOrdernumber.Text = ""
txt02pointer.Text = 0
quit:
End Sub
/vb
I believe the offending code is the SELECT statement. The select statement gets the lines, and checks the order, to make sure no lines are crosslinked into another order. On some orders, it works fine, but others, where the lines are low numbers such as 1, 2, or 3, the program bombs, with a FILE i/o error: data not found.
The program worked fine until the owner re-indexed or rebuilt all the indexes. Basically all the pointers changed for these lines, and now my program is freakin out and saying it cant find data.
Heres the code that previously worked, and STILL works on some orders.
vb
Private Sub Command1_Click()
Set rstMyrecset = Nothing
Set Mas90 = Nothing
Do Until strNextline = 0
If Ordernumber <> strSalesorder Then
MsgBox Err.Source & "The order number has changed." & _
"This order is crosslinked." & Err.Description, , "Error"
GoTo error:
End If
cmdMyrecset.CommandText = "SELECT LineIndex, LinkToNextLine," & _
" SalesOrderNumber, LinkToPrevLine FROM SO2_SOEntryDetailLine WHERE" & _
"(LineIndex LIKE '%" & strNextline & "')"
Set rstMyrecset = cmdMyrecset.Execute
strLineindex = rstMyrecset.Fields.Item("LineIndex").Value
strPrevline = rstMyrecset.Fields.Item("LinkToPrevLine").Value
strNextline = rstMyrecset.Fields.Item("LinkToNextLine").Value
strSalesorder = rstMyrecset.Fields.Item("SalesOrderNumber").Value
txtLineindex.Text = strLineindex
txtPrevline.Text = strPrevline
txtNextline.Text = strNextline
txtOrdernumber.Text = strSalesorder
txtLineindex.Refresh
txtPrevline.Refresh
txtNextline.Refresh
txtOrdernumber.Refresh
'Sleep 1000
'DoEvents
'Open "c:\windows\desktop\mylog.txt" For Append As #1
'Print #1, "Previous Line "; strPrevline, "Next Line "; strNextline, "Line Index "; strLineindex
'Close #1
Loop
MsgBox "The order started at 00 and ended in 00, and the order number did " & _
"not change. Pre-checking can be notified this order is OK."
error:
txtLineindex.Text = 0
txtPrevline.Text = 0
txtNextline.Text = 0
txtOrdernumber.Text = ""
txt02pointer.Text = 0
quit:
End Sub
/vb
I believe the offending code is the SELECT statement. The select statement gets the lines, and checks the order, to make sure no lines are crosslinked into another order. On some orders, it works fine, but others, where the lines are low numbers such as 1, 2, or 3, the program bombs, with a FILE i/o error: data not found.