SBX - Search With Button

SBX - Forum Post Title

SetObjectValue on Grid

Microsoft Dynamics SL Forum

LongTimeGPandSL asked a question on 26 Jul 2018 8:12 AM

Question Status

Unanswered

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.

J

 

Reply
Carolyn Froton responded on 8 Aug 2018 12:39 PM
My Badges

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 Then
Sum = Val (GetObjectValue ("cDocBal"))
LineAmount = FPSub (Original, Sum, 2)
Serr1 = SetObjectValue ("cTranAmt", Str$(LineAmount))
End If
End Sub

More on the LineGotFocus event is in the User Manual "Customization Manager Reference Visual Basic for Applications" page 44

Reply

SBX - Two Col Forum

SBX - Migrated JS