Execute a subform programmatically

thibaultthibault Member Posts: 6
Hello,

I have the following issue :
I would like to execute a subform (included in a tab of a form), only if a boolean is true. If it is false, I want it not to be executed.

After having intialized the three properties (Visible, Enabled, Editable) of my subform "lSubForm" to 'No', I tried the following code in the OnActivateForm() trigger :
IF gBool THEN BEGIN
    CurrForm.lSubForm.ENABLED:=TRUE;
    CurrForm. lSubForm.VISIBLE:=TRUE;
    CurrForm. lSubForm.FORM.EDITABLE:=TRUE;
END;

It does work, but the problem is, that my subform is not in the same range that my main form, and my customers won't automatically have the permission to execute the subform with their license. That's why I wanted to execute it, depending of a setup boolean.

Thanks for your help

Comments

  • matttraxmatttrax Member Posts: 2,309
    I don't understand the problem. Your customer is out of forms? They don't want to buy more? You want a way to get around licensing?

    It's something ridiculously cheap to buy a form, like $20 in the US if I remember right.
  • thibaultthibault Member Posts: 6
    That's not the problem.
    The thing is, that if one of my customer buy the right granule, they will have access to additionnal functionnalities, and one of those functionnalities is a tab (containing a subform) of a common form. But if he's not interested in this layer, I don't want his NAV to fail, as each of my customers will have the same version.
    Anyway, if the customer has the right granule, I want it to execute the form and its subform, but if he has not it, I don't want the subform to be executed because he will get an error.
    Thanks
  • matttraxmatttrax Member Posts: 2,309
    Use the Permission Range table: 2000000044

    You'll find all of the objects that can be executed and more.
  • thibaultthibault Member Posts: 6
    Sorry but I have not this table in my range on database.
  • kapamaroukapamarou Member Posts: 1,152
    It's a System table. You can see it through a Variable or a New Form based on it...
  • matttraxmatttrax Member Posts: 2,309
    Yeah, you won't see it in Object Designer. Just type in the number for your record variable when you define it.
  • thibaultthibault Member Posts: 6
    Thank you, I didn't know anything about this table and how to use it.
    However, I cannot see how it can resolve my problem. I can see if an object can be executed in my license, so that's cool. But if my object is not in this table, I would like dynamically not to execute it.
    Thanks a lot
  • MonstaMonsta Member Posts: 38
    You cannot do it with a subform, because when you call a form, subform of the form will always be executed regardless of it's "visible", "editable" etc properties.
    Use separate form, which user would call by pressing a button on the form.
  • thibaultthibault Member Posts: 6
    Ok, thanks, that what I was afraid.
    Thank you
Sign In or Register to comment.