web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

SetObjectValue on Grid

(0) ShareShare
ReportReport
Posted on by 1,114

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

 

*This post is locked for comments

I have the same question (0)
  • CFROTON Profile Picture
    4,710 on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans