Aspirin time .... I have two db (POLines and Inventory). I want to post the current POLines!ItemCost value into Inventory!ItemCurrentCost .
I can do it with XPost ... XPOST(@fn, ItemNum, "Inventory!ItemNum", ItemCost, "ItemCurrentCost", "").
But am trying to learn how to use XResultSetValue code. I tried to borrow from a previous thread, but my recurring result is always a value of 0.000 in the target Inventory!ItemCurrentCost, instead of $28.00.
Could someone give me a boot in the right direction? Many thanks!
#include "sbasic_include.sbas" var vRS as Int var vItemCCost as Money
If ((@Mode() = 1) or (@Mode() = 0)) and (@isBlank(POLinesYN) = 0) { vRS = @XResultSetSearch(@FN, "Inventory", SEARCH_MODE_AND,SEARCH_SYNTAX_QA, "!ItemNum=" + @Str(ItemNum)) If vRS > -1 { //Confirm exactly one matching record If @XResultSetTotal(vRS) = 1 { //Confirm I can change the Inventory record If @XResultSetLocked(vRS) = 0 { // Get the current ItemCost from POLines vItemCCost = @ToMoney(@XResultSetValue(vRS, "ItemCost")) // Post/Set the new POLines!ItemCost value to Inventory!ItemCurrentCost XResultSetValue(vRS, "ItemCurrentCost", vItemCCost) } Else { @MsgBox("Error: Inventory record is locked by another user.","","") } } Else { @MsgBox("Error: There must be only one matching Inventory record.", "", "") } XResultSetClose(vRS) //Close the result set } Else { @MsgBox("Error: Cannot open XResultSet.", "", "") } }
|