Skip to main content

Notifications

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

  • Adam Leonard Profile Picture
    2,151 on at
    Re: Adding Fields from a second table to a grid

    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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics SL (Archived)

#1
Community Member Profile Picture

Community Member 136

#2
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 102 Super User 2025 Season 1

#3
REUser Profile Picture

REUser 8

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans