Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field value out of table lookup range

Status
Not open for further replies.

mburger

Technical User
Sep 27, 2006
1
US
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
 
I don't think I'd do the final DataPostRecord since the only thing in the new record is the Order#.

I'd also set the order number in the Insert or NewRecord method, since you'd want new records from any source to set the Order# in the same way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top