Closeactiveobjet not working as expected

As a standalone procedure in the data sheet, this works perfectly:

field “County”

editcell

closeactiveobject

The goal is to tab from Field A to field B, open a textlistobject form, choose an option, close the window and tab to field C.

When I tab from the previous field into the «County» field, it calls a procedure that should open a form with a textlistobject that has a list of options. When I click on an option, it should enter that choice into the County field and close the form. Currently, when I tab into the County field, if the form opens while the field is active, Panorama X crashes. Adding closeactiveobject at the beginning of the procedure does nothing. If I put the code above in the procedure, add a Wait statement, and include an openform statement, it jumps to the field after County («Run»), it becomes active, then the form opens. I can click on a choice, the form closes, and the text is entered into the County field but the Run field is open. Unfortunately, it can’t be edited or closed unless I click in it. I would like closeactiveobject to close the Run field if I put it in the code tab of the textlistobject but it ignores the command. Editcell is ignored as well. Is there a better way to do this?

The person using this database had 300 choices in the choices tab of a Panorama 6 database, but this seems unworkable in Panorama X.

Is there a better way to do this?

There is no way to do this.

When I tab

It is absolutely NOT possible for you to add code that changes what happens when you tab from field to field. Basically you end up with Panorama trying to do two different things at once - perform the tab and do whatever it is that you want to do. Panorama cannot do two things at once, so you wind up with big problems, including possibly crashes. As you’ve discovered.

The most common change people want to do is dynamically change the tab order. In other words, instead of tabbing to the next field, tab to a different field depending on what the user entered. Since this is somewhat common, a special feature was added to allow to specify what field the tab should skip to. Notice that your code doesn’t actually skip to the field, it simply calculates the field name, which Panorama then uses. This code can’t do anything but calculate a field name - it can’t perform any other action (for example open another window).

What you want to do goes far beyond just changing the tab order - you want to completely change the behavior of the tab key. In this case you want pressing the tab key to open a different window. Panorama simply doesn’t offer this level of customization.

The person using this database had 300 choices in the choices tab of a Panorama 6 database, but this seems unworkable in Panorama X.

If you ask me, that was also unworkable in earlier versions or Panorama. Certainly this feature was NEVER intended for more than a couple dozen choices. I agree, using 300 choices is even more unworkable with Panorama X, so a different solution is needed. But having a form pop open when tabbing through the data sheet is not a possible solution. I would recommend either using text editing with Clairvoyance, or give up use of the data sheet entirely.

this works perfectly.

field “County”
editcell
closeactiveobject

I wonder what your definition of “works perfectly” is. When the editcell statement runs, the procedure pauses until the user terminates editing (by pressing Return, Escape, Tab, etc.). At that point the input window will close on its own. So what is the point of the closeactiveobject statement? The input window is already closed when that statement runs. It won’t hurt anything, but it won’t do anything either. You would get the exact same results with this two line procedure.

field “County”
editcell

In any case - it doesn’t matter. What you want to do IS NOT POSSIBLE.

Thanks Jim. As I said, I got it to work but it’s not perfect. When tabbing out of the «Solutions» field in the data sheet, the code in the field calls a procedure that tells it to go to the next field (County) but for some reason it goes to the field after that (Run), then there’s a wait statement, then the form opens and it puts the textlistobject selection into the County field but the Run field is frozen until you click in it. I guess you could say it doesn’t work as intended, but they click in the Run field anyway to enter data so…

I finally talked the client into using a form for data entry. She’s been fighting it for years. With the data entry form, the tabing sequence brings up the list, then accepts the selection and advances to the next field. Once they realize they can see all their data for a record at once, they’re hooked.