Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

modifier VBA third party form field

Posted on by 45

Hi,

I want to read the value of Document Number field from SelectionScroll window in CN_Aging_Inquiry form. I can see the value using warning. How do I return the value to my local variable in VBA?  Any help is greatly appreciated.

 

Thanks

 

-Divyanshu

 

Private Sub Grid_BeforeLinePopulate(RejectLine As Boolean)

 Dim CompilerApp As Object

    Dim CompilerMessage As String

    Dim CompilerError As Integer

    Dim Commands As String

    Dim docNo As String

 

    Set CompilerApp = CreateObject("Dynamics.Application")

    Commands = ""

    Commands = Commands & "local text code; " & vbCrLf

    Commands = Commands & "local string compile_message;" & vbCrLf

    Commands = Commands & "local integer context; " & vbCrLf

    Commands = Commands & "local string docNo; " & vbCrLf

    Commands = Commands & "local integer error_count; " & vbCrLf

    Commands = Commands & "{Build the pass-through sanScript code.} " & vbCrLf

    Commands = Commands & "context = 1157; { CM } " & vbCrLf

    Commands = Commands & "clear code; " & vbCrLf

    Commands = Commands & "code =code + ""inout string docNo;"" ; " & vbCrLf

    Commands = Commands & "code =code + ""warning 'Document Number' of window SelectionScroll of form CN_Aging_Inquiry;"" ; " & vbCrLf

    Commands = Commands & "code = code + ""set docNo to 'Document Number' of window SelectionScroll of form CN_Aging_Inquiry;"" ;" & vbCrLf

    Commands = Commands & "error_count = execute(context, code, compile_message, """ & docNo & """);" & vbCrLf

    Commands = Commands & " if error_count <> 0 then"

    Commands = Commands & "    {A compiler error occurred. Display the error.} " & vbCrLf

    Commands = Commands & "    error compile_message; " & vbCrLf

    Commands = Commands & "end if; " & vbCrLf

    CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)

    If CompilerError <> 0 Then

        MsgBox CompilerMessage

    End If

 

    MsgBox "Invoice No: " + docNo

 

End Sub

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: modifier VBA third party form field

    Use the below instead:

    Dim CompilerApp As Object

    MSGBOX (CompilerApp.GetDataValue("'Document Number' of window 'SelectionScroll' of form 'CN_Aging_Inquiry'"))

  • DinB Profile Picture
    DinB 3,812 on at
    Re: modifier VBA third party form field

    How about create a global variable in the VBA, and assign the value of docNo to that variable.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans