>This is the part I am having trouble with. Currently inventory table instock
is the data environment of both forms. Should it be? Then how does the method
access lastest value of nqty in instock?
Since I don't know all of the functionality that's built into Form A it's hard for me to say if you should open the instock table. (For example, Form A may adjust the instock.nQty when you save the order.) But for the lookup validation, I prefer to use views like this:
Create your view...
CREATE SQL VIEW lv_InStockItem AS ;
SELECT * FROM instock ;
WHERE instockID = ?vp_InStockID
Now in the StockTooLow() method :
FUNCTION StockTooLow
LPARAMETERS tnInStockID, tnCheckValue
*-- set your view parameter.
LOCAL vp_InStockID
vp_InStockID = tnInStockID
*-- Skip this part if you open the view in the form's Load().
IF NOT USED('lv_InStockItem')
USE lv_InStockItem IN 0 NODATA
ENDIF
*-- Now get the latest data.
REQUERY('lv_InStockItem')
*-- Now do your validation....
By requerying the view you will get the most current data.
HTH
George Simon, MCP