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)

Adding Fields from a second table to a grid

(0) ShareShare
ReportReport
Posted on by 105

Hello I am trying to add two fields (clientname and SSN) from a custom table to an existing grid in Cash Account Transaction Screen.

The fields are read only.

there are several problems with my code.

When I add the VBA_Mextend code to the Form_Display I can add the lines in the grid and it let me choose the name and ssn based on the clientid (User field in catran table). But when I click Save the last line is erased.

If I have click on the line below the last line and then click save then the batch will save with all the line correctly.

Private Sub Form1_Display()


Dim Handle As Integer
Handle = GetGridHandle("Spread1")
serr1 = VBA_Mextend(Handle, bxSBSCustom, LenB(bxSBSCustom))

End Sub

 

I thought that I should add the code to the Update1 event. But it still erases the last line and plus resets the name and ssn on all lines to the name and ssn on the first line.

Private Sub Update1_OnUpdate(Level As Integer, InsertFlg As Integer, retval As Integer)

Dim MaintFlag As Integer
Dim Handle As Integer
Dim RowNum As Integer
Dim tempclientid As String

tempclientid = GetObjectValue("xuser1")

Handle = GetGridHandle("Spread1")
RowNum = MGetRowNum(Handle)
serr = MFirst(Handle, MaintFlag)

Do While serr = 0
       Call SqlFetch1(CSR, "xSBSCustom_All" + SParm(tempclientid), bxSBSCustom, LenB(bxSBSCustom))
        
Call MUpdate(Handle)
serr = MNext(Handle, MaintFlag)
Loop

Call msetrownum(Handle, RowNum)

Call MDisplay(Handle)


End Sub

 

*This post is locked for comments

I have the same question (0)
  • Adam Leonard Profile Picture
    2,151 on at

    Hi,

    This question is best posed in a support case where we could obtain all of your code/files and further troubleshoot.  

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