Next control from trigger OnLookup

I have put som code on a field on a form (the form is running on “nothing”) on the OnLookUp trigger. I want to be apple to control what the next control should be. I have tried something like this: CurrForm.“Next control”.ACTIVATE; but it doesn’t work! The code works fine on OnValidate-trigger…

Hi Jens, I asume that You want the NextControl to be variable, depending on what is selected OnLookup/put in the control. Otherwise the NextControl-property on the actual Control is the way to do it. You state that the code works when put on the OnValidate-trigger. Why not keep your code here? The OnValidate-trigger is always executed if the content of the control changes, but the OnLookup-trigger is only executed if the user actually does lookup. So, if your user knows what to put in the control, without doing the lookup, the OnLookup-trigger is not executed. regards Alexander

Hi Alexander No, OnValidate is not activated if the user places input in the field via the OnLookup - trigger[:(]

quote:

No, OnValidate is not activated if the user places input in the field via the OnLookup - trigger

I’m pretty sure that it is. It is, however, not executed until the user leaves the control. But I don’t see that as a problem, as what You want to control is where the cursor goes. Try putting this code on the OnValidate-trigger on the “Post Code”-control in form 1. IF “post code” = ‘2630’ THEN CurrForm.Address.ACTIVATE ELSE CurrForm.Name.ACTIVATE; With this code the cursor will go to Address, if the Post code is defined as ‘2630’, no matter if it is entered via lookup or not.

Hi Alexander I think it works on Form 1 because there’s a sourcetable…I have “hand-coded” a look-up function and the OnValidate trigger is not executed! So what I’m looking for is a way of forcing the OnValidate trigger to be executed[:)]

Hi Jens, Sorry You’re right. [:o] I have just created a little form, that have no sourcetable, and on which all controls have no tablerelation. If I put more or less the same code in the very end of the OnLookup-trigger (after the variable has been assigned its value), then the cursor jumps to the correct control. Remember to leave the same code on the OnValidate-trigger, aas it is this trigger that are executed if the user chooses not to do the actual lookup. /alexander

Hi Alexander We’re getting closer to the solution[:)]…It works fine with code on the OnLookUp trigger, but only when the next control is a text-box! When I want the cursor to jump to the OK-button from a textbox , I can get it activated but focus is still on the textbox (the text is marked blue)?? Do you have any solution to this? /Jens