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 GP (Archived)

Check error state of Dynamics GP window using VBA

(0) ShareShare
ReportReport
Posted on by 121

I am trying to add a couple of field and check boxes into the Debtor Item Maintenance window in Dynamics GP. I have managed to get these added and they are working fine including using DUOS to read/write/delete the information stored in these fields for each debtor item. 

The issue I am currently having is that when I type a debtor ID or item number that does not exist into their respective fields, I want the VBA code to recognise that an incorrect debtor ID or item number has been entered and therefore not continue with the code. 

For instance, in the code below, the sub runs after the debtor ID has been changed and enables the new check boxes. However I don't want it to run if the debtor ID has been flagged as one that doesn't currently exist.

Private Sub DebtorID_AfterUserChanged()

    ' Check that the DebtorID isn't incorrect
    ' This would result in GP raising an error box asking
    ' if the user wants to cancel or add the new Debtor ID
    ' If this error has been raised, don't run the code below

    ' Enable the new check boxes
    NewCheckBox1.Enabled = True
    NewCheckBox2.Enabled = True


End Sub


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    MG-16101311-0 Profile Picture
    26,225 on at

    Typically, every Microsoft Dynamics GP maintenance window has a field called Display Existing Record. This field is a checkbox data type field and is set to true if the current record was displayed successfully.  What you want to do is temporarily move this field to the Debtor Item Maintenance window and change the Visible property True. You will then want to add this field to VBA like you've done with others.

    You will change your event to evaluate on this field rather than what you are trying to do currently. NOTE: both the item and vendor fields will run the Display Existing Record change script and will set the proper value to this check mark.

    Once you have added the field to VBA, don't forget to return to Modifier and move the field back off the screen and set the Visible property to False.

  • RyanSinfield Profile Picture
    121 on at

    Mariano, thanks for the reply. How do I move this existing field into the Debtor Item Maintenance window?

  • RyanSinfield Profile Picture
    121 on at

    Better yet, is there a tutorial or something I can look at for a detailed explanation?

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 GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans