close alookup form


I want the lookup form to be closed after ok is pressed. how to do?

If you did build your lookup form in standard way you will get OK and Cancel buttons for free. Pushing either OK or Cancel button will close the form when used from lookup field.

In the case of a standard lookup form there might be some code in the OnQueryCloseForm trigger that prevents the form from closing.

If you open the form in look up mode, it will be closed on clicking the ok button.

Take a look at the OK button on a standard NAV form (like Location List) to see how it works. Check the properties.

i wrote the code for lookup-


then the lookup form is not closing on clicking OK.

The OK button should also do it’s ‘normal’ work when the lookup is programmed.

Where did you put this code and how is the broader code context of this one line of code you are displaying?

If you create a form using the wizard an OK button will be added automatically. You can’t just put a button on there with a caption of OK and have it close the form. You can look at using CurrForm.CLOSE, but it would be much better if you took my advice above and looked at the properties of an OK button on a standard NAV lookup form.