Pop-up menu object reluctant to display its value

I have a pop-up menu object which, when I open the form for the first time, doesn’t display the value that was selected on a previous visit. The value is in the data sheet but not in the object in any of several selected records. Switching to graphics mode and back forces the display and choosing the value from the menu in any one record forces the display in all others. Thereafter, the menu displays correctly.

I have rebuilt the pop-up several times but that hasn’t helped.

The menu is populated by the contents of a global variable declared in a master database from which the problem form and many others are opened. The default for variables created in the form is fileglobal and I thought that might be the problem but testing suggests that it’s not.

My problem is vaguely related to this one:

The list of values that are available in a pop-up menu button are those defined in the Formula for the button. I understand from your post that your button uses a global variable in the formula. The selected value is assigned to the variable (or field) in the “Data” box of the Popup Button Options. By default that can be a a global, fileglobal or windowglobal variable, which will be created the first time the form is displayed if it does not already exist. The type of variable created depends on the Form Preferences. The wrong form of variable I think could cause it to be lost in between visits. That is, I think a window global variable would be lost if the form were closed then re-opened. (I do note that you said that it is a fileglobal variable!)
Also, if the button is blank, it could be caused if the value of the variable changed to a value that is not among the menu choices.
I suspect, but am not sure, that the button display can be refreshed with a showvariables statement, which you. could place in the Procedure tab of the form after an if info(“formevent”) match “open” (or “front”) statement.
Finally, long ago I had buttons that seemed to stop working. I replaced them with the exact same parameters and the new ones worked, but I have not observed that in many months, if not a year or more.
Hope some of that gives you some ideas on solving the problem.

Thanks Tom - I thought I had the showvariables aspect of it covered because I had a statement with lots of variable names in it - turns out that particular one was absent!

I don’t believe that the variable type is a problem but I may well be wrong. In this particular application (my farm management system), I have numerous variables which populate pop-up menus in multiple forms across several databases so it was much easier to make them globals than to add another level of complexity to an already complex system.