Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Opening a Form with a Button

(0) ShareShare
ReportReport
Posted on by 582

Where can I find information on how to add a button to a Great Plains form that will open another form and pass a key field?  It seems straightforward - but I am not getting anywhere.  Is this something that would have to be done with Dexterity or would Modifier / VBA be able to do this.

I have a form on which I already have some VBA that and one custom button, and the VBA code takes the key field from the form and passes it to a URL and shells out to a browser and all that works well

Now I need to add a button that will open another GP form and pass the key field.  I have added  a button and added code to the AfterChanged event of the button (I have not even attempted to pass the key field yet, I just want to see how to open the form:

MyFormName.Show

This compiles in VBA editor.  The Form I am trying open is from another VBA project, MekormaMICR, and I added that reference to the Dynamics project and when I type the form name and then the period, Intellisense provides me all the methods, so VBA is recognizing the call I am making to this form

However when I try to click the button when running the modified form I get an "Object Not Available" run-time Microsoft Visual Basic error

So - am I on the right path?  Can someone point me in the right direction?

Thank you

*This post is locked for comments

  • L Vail Profile Picture
    65,271 on at
    RE: Opening a Form with a Button

    Hi Devinmcm,

    If this answered your question, please mark the question as answered.

    Kind regards,

    Leslie

  • devinmcm1 Profile Picture
    582 on at
    RE: Opening a Form with a Button

    This all works - thank you for all the feedback

  • Verified answer
    L Vail Profile Picture
    65,271 on at
    RE: Opening a Form with a Button

    Hi,

    I added a button to the batches form and then added this code:

    Option Explicit

    Public TrxBatchID As String

    Private Sub PushButtonM34_BeforeUserChanged(KeepFocus As Boolean, CancelLogic As Boolean)

    Let TrxBatchID = Trim(PayablesBatchEntry.BatchID)

    'MsgBox (TrxBatchID)

    PayablesTransactionEntry.Open

    Let PayablesTransactionEntry.BatchID = TrxBatchID

    End Sub

    It opened the Transaction entry window and populated the Batch ID.  

    Does this work for you?

    Kind regards,

    Leslie

  • L Vail Profile Picture
    65,271 on at
    RE: Opening a Form with a Button

    Hi,

    I just added a button to the batches window, and I got the same results that you did. I haven't yet tried the VBA code, but it seems pretty doable. I'll try it tomorrow unless you have solved it by then.

    Kind regards,

    Leslie

  • devinmcm1 Profile Picture
    582 on at
    RE: Opening a Form with a Button

    Ok - setting to Open worked.  I guess the only thing I have left to do now is pass a key field.  I am on the Payables Batch Form and want to open the Print Checks form and pass the Batch ID.

    Let me explain the reason why I have to do this.  We have a modified Payables Batch Entry screen that contains a button to a custom SSRS report designed to support the business processes at this company to process an AP or Check batch.  

    If you are familiar with the Batch Entry form, you will know that when you click the Transactions button while on a Computer Check batch, the Payables GoTo window pops up with various choices, Print Checks, Edit Check Batch, etc

    This form was working in our previous version of Great Plains, 9.0   we finally upgraded to GP2013 and now if the Payables Batch Entry form is the Alternate / Modified form, the GoTo screen gets corrupted and none of the choices show up anymore.  I have proven this by toggling back and forth between Default / Modified for the Batch_Entry form and it appears that no matter what, even if there is only one modification on the form, when you use the Alternate Batch Enrty form the GoTo form will not work, so I am trying to provide an alternate way to get to the Print Checks screen that comes close to keeping their current process they have been using for 6 years intact.

    Thank you

  • Suggested answer
    L Vail Profile Picture
    65,271 on at
    RE: Opening a Form with a Button

    Hi again,

    I see now that you are using 'show' and not 'open'.

    If you first check if the form is loaded, and then use open if it is not, you may get what you need. So your change script might look something like this:

    If FormName.IsLoaded = false then

    FormName.Open

    End if

  • L Vail Profile Picture
    65,271 on at
    RE: Opening a Form with a Button

    What code do you have attached to your button?

  • Suggested answer
    Tom Mathew Profile Picture
    1,750 on at
    RE: Opening a Form with a Button

    and try comparing all the references and objects used in the other project with the current one. Can be b'coz of a missing object(dll or ocx) / reference.

  • Tom Mathew Profile Picture
    1,750 on at
    RE: Opening a Form with a Button

    Just try debugging your code and attach the code here so that we will have a better idea

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

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

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Almas Mahfooz Profile Picture

Almas Mahfooz 3 User Group Leader

Featured topics

Product updates

Dynamics 365 release plans