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)

Using Public Variables in VBA - Scope of the Public Variable

(0) ShareShare
ReportReport
Posted on by 215

I am trying to figure out an issue for some users and I think I have figured out why it happens, but want to know if it is even possible before I adjust the code and fix it.

What I am looking for is the scope of public variables on a terminal server with multiple people using the same client at the same time.  The question is, if 2 users are executing the same code from the same window, could their variables be crossing up?  Meaning user A is in one Rrder (VBA is setting the public variable to one value) User B is on the same client, same window, can their code be updating the public variable for the other user?

Basically, this is a GP 9 Install and there is some pretty heavy VBA going on.  The VBA makes calls to the database to select data, update data, and execute stored procedures.  Users are compalaining that random records are being updated.  This is mainly date fields from the SOP Transaction Entry Date Expansion Window keeing in synch with User Defined Date Fields in the User Defined Window on the SOP Screen.

The original programmers used some public variables in the code on the SOP window.  Like Document Number, Requested Ship Date and 2 other date fields that are custom (stored in the user defined table, but can be accessed on the date expansion window.)

We have triggers on the tables that track all Inserts, Updates and Deletes, so I can see the flow of what happened by the timestamp (luckily).  I am finding that a user is updating a record for one order (or quote) by an event, and those dates are being updated via SQL (stored proc with parameters being passed from these public variables), but occasionally it is a completely different Order Number of Quote that is being updated with those dates.  I am thinking that another user might be in the window at the same time on a random order and it is switching out another user's public variable just before they call the stored procedure to update.  So it literally passes a completely different SOP Number that what the first user is intending to update.

Is that even possible?  That would not happen on users with local clients I would imagine because they are using differnt memory to store the variable.  But could it if the users are on the same client?

*This post is locked for comments

I have the same question (0)

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