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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Add button to open another SL window

(0) ShareShare
ReportReport
Posted on by 1,639

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

I have the same question (0)
  • Apps Mexico Profile Picture
    1,090 on at

    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

  • Jo Wykerd Profile Picture
    1,639 on at

    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

  • Jo Wykerd Profile Picture
    1,639 on at

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

  • Apps Mexico Profile Picture
    1,090 on at

    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
    1,639 on at

    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!

  • Jo Wykerd Profile Picture
    1,639 on at

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

  • Apps Mexico Profile Picture
    1,090 on at

    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
    1,639 on at

    Thanks again!

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

  • Jo Wykerd Profile Picture
    1,639 on at

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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans