General information
Category:
Forms & Form designer
>>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:
Yes it does update nqty, replaces nqty with nqty - qtyissued, which is why instock is included in the data
environment. There are two problems I have with using private data session in this case. Both seem to
be related to fact that orders form A does not see changes made by inventory maintenance form B.
1. Is the validation problem which could be solved by using a view
2. When updating the instock table the original value of nqty is used so that it results in negative values for nqty,
This is a major issue. Not sure what best approch is here.
>
>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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only