OnChange and Dialog Boxes

Hi,

I’ve got a dialog box with several fields on it, and for each I have added some code in the OnChange event to check the size of the field and report back if it’s too big. This works fine for all the fields on the dialog box, except the last one.

If I tab through each field and the contents is too big, a messagebox comes up alerting the user. When you tab out of the last field (and subsequently highlight the Ok button) the OnChange code doesn’t appear to run. The only way I can get it to run is by either tabbing though Ok and Cancel until the first field is selected again, by clicking on another field in the dialog box, or by putting another field at the end of the dialog box which is then tabbed in to. None of these solutions are desirable, does anyone know why the last exiting event isn’t triggered when you tab out of the field and on to the OK button?

I’ve just found that if you click the OK button after filling in the last field, the OnChange code is also triggered then but by that stage it’s too late to get the user to change the field contents. I know I could check the field in the QuerySave event of the dialog box and prevent it from closing with continue = false but I would rather each field behaved in the same way.

Any help with this would be greatly appreciated.

Subject: OnChange and Dialog Boxes

I’ve come across this before as well, and I believe I ended up putting an empty text field that had the show field delimeters box unchecked. The tab would take the user into that field and a translation formula would always make sure it was empty. A hack, yes.

I believe this issue is caused because onChange runs when you change a field and then leave it, and control has to go somewhere that is actually “on” the form, which the OK/CANCEL buttons really are not.

Subject: RE: OnChange and Dialog Boxes

Thanks for the response. I’m not sure if I’ll be allowed to put the blank field at the end but it’s certainly worth asking anyway. Cheers for the explanation anyway!