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)

Cannot set the value of a field on a form via VBA

(0) ShareShare
ReportReport
Posted on by 360

 Hi,

 I'm trying to add some VBA code to the "Internet Information" card of GPs "HR and Payroll" module and have the following line in my code:

INet1.Value = "some value"

However, when i run the VBA i get the following error even though the code is not on any of the events mentioned in the error (it is on the Changed event)

Runtime error '10006' - The operation cannot be performed in the target field's AfterUserChange, BeforeLostFocus, or AfterLostFocus Events. This operation could compromise the integrity of the application.

Whatever  i do it doesn't seem to allow me to set the value of the field. Could someone advise as to what i am doing wrong!

Also, as a separate issue (but related to what i'm trying to do) how can i supress to closing of the window? I want to run some validation when the user tries to close the window and if the values fail the validation i want the form to stay open.

Thanks

*This post is locked for comments

I have the same question (0)
  • Jeganeedhi Krishnan Profile Picture
    2,500 on at

    Matthew,

                  1.Where (i.e field's AfterUserChange, BeforeLostFocus) you have try to set the value?

                  2.Answer for secound question. AbortClose = True will supress to closing of the window.

    Private Sub Window_BeforeClose(AbortClose As Boolean)
          AbortClose = True
    End Sub

    Regards

    Jeganeedhi

  • Matthew Panayiotou Profile Picture
    360 on at

    Hi Jeganeedhi,

    Thanks for the answer to question2. For question1, I have tried setting the value in the Changed event handler. i.e.

    Private Sub INet1_Changed()
       INet1.Value = "Some Value"
    End Sub

  • Jeganeedhi Krishnan Profile Picture
    2,500 on at

    Hi,

    The BeforeGotFocus, AfterGotFocus and BeforeUserChanged events are the

    only three window field events where VBA allows you to set the value of the

    current field

    Thanks

  • Matthew Panayiotou Profile Picture
    360 on at

    Aha...Something to be aware of. Thanks

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