We often do minor customizations via Customization Manager and VBA. Sometimes this involves setting a value using SetObjectValue.
In this case the client is on SL2015, and we have a button on the order header that retrieves data with a SQLFetchStatement. The data is then displayed for the end user via a MsgBox statement. That works well.
Our next step then is to take the same data and position it in the soline or grid. Again, typically we'd do this with a SetObjectValue but grids are a bit more challenging. The update needs to happen for one line only for one particular inventory Id. My question is how do I get the cursor to focus on the specific inventory Id and then update a field in this case the unit price. The line will already exist. I just need to focus on it and update the unit price field?
Please advise. Look forward to a response.
To get focus on a line, there is a LineGotFocus event that could be used. if I am misinterpreting what you need, let me know.
This example accumulates the total transaction amount in Accounts Payable Voucher and Adjustment Entry (03.010.00) and defaults the transaction amount for each line to the amount required to “balance” the document to the details. Place the following three lines in General_Declarations:Dim Original#Dim Sum#Dim LineAmount#Sub spread1_linegotfocus(maintflg%, retval%)Original = Val (GetObjectValue ("cOrigDocAmt"))If maintflg = INSERTED and Original <> 0 ThenSum = Val (GetObjectValue ("cDocBal"))LineAmount = FPSub (Original, Sum, 2)Serr1 = SetObjectValue ("cTranAmt", Str$(LineAmount))End IfEnd Sub
More on the LineGotFocus event is in the User Manual "Customization Manager Reference Visual Basic for Applications" page 44
Business Applications communities