This is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.
Every time a Service Pack for Microsoft Dynamics GP is released, there is a potential for the installation of the service pack to cause Illegal Address errors for a field on Modified or Alternate windows. I have seen this a few times over the years, mostly with the Sales Transaction Entry (SOP_Entry) window in the Sales Order Processing (SOP) module.
The reason for this error is usually that the Service Pack adds a new field onto the window and also updates the scripts to use this new field. If the Modified or Alternate version of the window has not been updated to include this new field, when the code executes and references the missing field, the error is generated.
Illegal Address for field field name in script script name
How can I fix an Illegal Address Error on an Alternate or Modified window after installing a Service Pack?
Firstly, you should confirm exactly which version of the window is “at fault”. Use the security settings (or the Alternate Modified Forms and Reports ID for GP 2010) to tell the system to use the Original version of the window. When using the Original, there should be no error.
Note: If you get an error referring to a missing resources added by the Alternate window, it means that the addon product is not checking to see if its Alternate window is in use before running its trigger code. The best practice for handling this is explained in the following Knowledge Base (KB) articles:
- Rules to maintain alternate windows when you make customizations in Dexterity in Microsoft Dynamics GP (KB 929211)
- Error message when you access new fields from an alternate window in Microsoft Dynamics GP: “Illegal Address for field ‘field name’ in script ‘script name'” (KB 941327)
If the problem occurs only on the Modified or Modified Alternate version of the window, but works on the Original or Alternate version of the window, then you will need to just recreate the Modified window. The following steps should resolve the issue:
- Using Customization Maintenance (Tools >> Customize >> Customization Maintenance) export the window as a package file.
- If there is Visual Basic for Applications (VBA) code associated with the window, open the window and select Tools >> Customize >> Remove Current Window from Visual Basic.
- Then go into the Modifier (Tools >> Customize >> Modifier), select the appropriate product, locate the form containing the window and Delete it.
- Return to Microsoft Dynamics GP (File >> Microsoft Dynamics GP) and use Customization Maintenance to import the package saved in step 1.
This process will recreate the window from the Original (or Alternate) version and will not include the previously missing field.
If the problem occurs with an Alternate version of the window, then the solution has to be handled at the Dexterity level. The cause is the same (missing newly added field), but the resolution is slightly different. To fix the issue:
- Load Dexterity with your development dictionary.
- Make sure all your code is checked into your source code repository (usually Microsoft Visual Source Safe).
- Make sure your Index File is up to date. Update it again if you have added any new resources since last build.
- Make sure that the Original Dictionary (Edit >> Options >> Source Control) is pointing to a clean dictionary of the latest Service Pack build. This is usually the dictionary in the application folder after installing the Service Pack.
- Exit Dexterity and rename or move your development dictionary.
- Copy the clean dictionary (as referenced in step 4) to your development folder and rename it to your development dictionary name.
- Launch Dexterity again and Update using index file (Explorer >> Source Control >> Update) to bring in your customization.
- Recompile the entire dictionary and exit Dexterity.
- Use the Dexterity Utilities to recreate your chunk (usually using already recorded macro).
Note: If there is a Modified version of the Alternate window, you will also need to perform the first set of steps to update that version.
That’s all folks. Hope this is helpful.
This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.