Value lists don't update depending on how field is selected
I have a script that I run OnObjectEnter for a bunch of fields. It sets a global field to a predetermined ID based on the field you are entering. This ID is used in a relationship to determine what values from a related table should be shown in a value list in the field you just entered. So for example:
Enter the zip code field -> script triggers, sets global ID field to "zip code" -> the zip code field's value list shows the appropriate zip codes based on this relationship.
This works fine when I am tabbing between fields, as soon as I tab to a field the global ID updates and the correct values are shown. However, if instead of going straight from one field to another I deselect all fields and then select another field, the script triggers but not before the value list is displayed. This means that if I click in to the zip code field, deselect all fields, then click in to the city field, it shows a list of zip codes. If, however, I tab from the zip code field to the city field, it correctly shows a list of cities.
I apologize if my question is confusing. I'm not sure if the problem is in how OnObjectEnter is triggered, or in how value lists are indexed. I have a workaround with a script step that takes the focus to a different field, and then back to the one you just entered, which works but seems sloppy. Thank you for any and all help!