I have a pushbutton function for a "new order". Code does all math functions, creates a temp table, clears form, adds another order number (sequential). I had to re-do form, but did a cut/paste of this pushbutton. Now getting the "field value out of lookup table range", and table locks. The math functions operate, the form is cleared, and the new order number posts, but then the table locks and I get error message.
See code below:
method pushButton(var eventInfo Event)
var
orderTbl Table
temp totalTable
TCTotal TCursor
temp2 Smallint
endvar
if self.isEdit() then
temp.MBOrder = MB_Order_#
temp.PO = PO_#
temp.TotalPrice = Total_Price
temp.Date = Date
temp.TotalComm = Total_Comm
temp.EndUser = 0
temp.Cust = Customer_#
temp.Vend = Vendor_#
temp2 = MB_Order_#
TCTotal.open("Total.db")
if TCTotal.locate("MB Order #", temp2) then
else
TCTotal.edit()
TCTotal.insertRecord()
TCTotal.postRecord()
TCTotal.close()
endif
endif
action(DataBeginEdit)
action(DataInsertRecord)
orderTbl.attach("ORDERH.DB")
MB_Order_#.Value = orderTbl.cMax("MB Order #") + 1
action(DataPostRecord)
endmethod
See code below:
method pushButton(var eventInfo Event)
var
orderTbl Table
temp totalTable
TCTotal TCursor
temp2 Smallint
endvar
if self.isEdit() then
temp.MBOrder = MB_Order_#
temp.PO = PO_#
temp.TotalPrice = Total_Price
temp.Date = Date
temp.TotalComm = Total_Comm
temp.EndUser = 0
temp.Cust = Customer_#
temp.Vend = Vendor_#
temp2 = MB_Order_#
TCTotal.open("Total.db")
if TCTotal.locate("MB Order #", temp2) then
else
TCTotal.edit()
TCTotal.insertRecord()
TCTotal.postRecord()
TCTotal.close()
endif
endif
action(DataBeginEdit)
action(DataInsertRecord)
orderTbl.attach("ORDERH.DB")
MB_Order_#.Value = orderTbl.cMax("MB Order #") + 1
action(DataPostRecord)
endmethod