Skip to main content

Notifications

Microsoft Dynamics SL (Archived)

Add button to open another SL window

Posted on by 1,615

Hi there,

Does anyone know what VBA code i could use to open the Code File maintenance screen (PACFM) from a button added on the Project Controller screen (PAPRJ)?

Thanks

*This post is locked for comments

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Add button to open another SL window

    Don't worry - figured out what to do!!

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Add button to open another SL window

    Thanks again!

    Another question :- am i able to run a quick query from from a button on  the Project Controller screen?

  • Apps Mexico Profile Picture
    Apps Mexico 1,090 on at
    RE: Add button to open another SL window

    Hi,

    You can't do add another parameter to the DBNav store procedure, because the call that load the data on the screen is on the standard level.

    Maybe you could try to delete the rows from de memory array after the data is loaded on the screen. To do that you could try using the functions GetGridHandle, MNext, MDelete, but i'm not sure if that works ok.

    Instead of that I recommend you develop another window with that use the two parameters.

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Add button to open another SL window

    Juan Carlos, were you able to help me with this extra customisation on this screen please?

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Add button to open another SL window

    Hi Juan Carlos,  

    I would now like to only load some of the lines in the grid on the Code File Maintenance screen depending on a second parameter passed across.  The field on the table PJCODE i need to filter on is Data1 ie. i don't want all records for the control_code passed across loaded in the grid - only the ones where data1 = the second parameter i am passing across.  Hope this makes sense and that you are able to help!

  • Apps Mexico Profile Picture
    Apps Mexico 1,090 on at
    RE: Add button to open another SL window

    I'm glad to hear that.

    Yes, acctually the erroris that the name of the parameter must be the same on the ApplSetParmValue and ApplGetParmValue.

    Error:

    Call ApplSetParmValue(PRMSECTION_VBRDT, "control_code", Trim(Scode))

    sCode = Trim(ApplGetParmValue(PRMSECTION_VBRDT, "ccode_type"))

    OK:

    Call ApplSetParmValue(PRMSECTION_VBRDT, "control_code", Trim(Scode))

    sCode = Trim(ApplGetParmValue(PRMSECTION_VBRDT, "control_code"))

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Add button to open another SL window

    Don't worry Juan, I have figured out my problem!  Thanks for your help

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Add button to open another SL window

    Hi Juan,

    Thank you for your reply.

    I have added code which is now opening Code File maintenance screen from the Project Controller screen successfully.  The only think i am having a problem with is the parameter i am trying to pass is not working.  Are you able to advise please.

    Here is my code:-

    Original window

    Private Sub Button1_Click()

       Dim Scode As String

       Scode = "REVT"

       Call Edit_Save

       Call ApplSetParmValue(PRMSECTION_VBRDT, "control_code", Trim(Scode))

       serr1 = Launch("PACFM00.exe", True, True, 0)

       Call Edit_Cancel

    End Sub

    Receiving window

    Option Explicit

    Dim sCode As String

    Private Sub Form1_Display()

       MsgBox "display " & sCode

       If Trim(sCode) <> "" Then

           Call SetObjectValue("ccode_type", Trim(sCode))

       End If

    End Sub

    Private Sub Form1_Load()

       MsgBox "load " & sCode

       sCode = ApplGetParmValue(PRMSECTION_VBRDT, "ccode_type")

       sCode = Trim(ApplGetParmValue(PRMSECTION_VBRDT, "ccode_type"))

       If Trim(sCode) <> "" Then

           Call SetObjectValue("ccode_type", sCode)

       End If

    End Sub

  • Apps Mexico Profile Picture
    Apps Mexico 1,090 on at
    RE: Add button to open another SL window

    Hi,

    If you wanna pass data to the other screen you can use something like this:

    --Pasa valores de una pantalla a otra

    --Pantalla origen

        Dim sCustID As String

       

        Call GetBufferValue("bCustomer.CustID", sCustID)

        If Trim(sCustID) <> "" Then

            Call Edit_Save

            Call ApplSetParmValue(PRMSECTION_VBRDT, "CustID", Trim(sCustID))

            Call ApplSetParmValue(PRMSECTION_VBRDT, "ShipToID", "DEFAULT")

            serr1 = Launch("xUsr_Screen\xFE0200.exe", True, True, 0)

            Call Edit_Cancel

        End If

     

    --SL 7

            Call ApplSetParmValue(PRMSECTION_VBRDT, "BatNbr", bxINPedidoInterCoH.BatNbr)

            Call CallApplicWait("xUsr_Screen\xIN1900.exe", String.Empty)

     

            Call Edit_Cancel()        

     

    --Pantalla destino

    Option Explicit

    Dim sCustID As String

    Dim sShipToID As String

     

    Private Sub Form1_Display()

        If Trim(sCustID) <> "" Then

            Call SetObjectValue("cCustID_0", Trim(sCustID))

            Call SetObjectValue("cShipToID_0", Trim(sShipToID))

        End If

    End Sub

     

    Private Sub Form1_Load()

        sCustID = ApplGetParmValue(PRMSECTION_VBRDT, "CustID")

        sShipToID = ApplGetParmValue(PRMSECTION_VBRDT, "ShipToID")

     

    o

     

    Dim custId as String = trim(ApplGetParmValue(PRMSECTION_VBRDT, "CustID"))

     

    IF String.IsNullOrEmpty(custid) = false then

    call setobjectvalue("txtCustID_0", custiID)

    end if

     

    End Sub

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans