Form does not recognize control

On Navision Financials 2.6e running on SQL 2000, I made some modifications to a form (the sales order form). When I run it with a user with full super privs, it works. Compiling of the form works without a problem. But, when I give it to my users to go in to the form, who of course have limited privs, I get an error “The form does not recognize the control 181” and it does not allow the form to open. If I remove the control it works fine. The control in question is a warning message. I have on the form a label, and in the OnInit and OnAfterGetRecord, I put in code to check to see if the message should be displayed. If it should, it makes it visible, if not, it is not visible (control 181). Since the control is just a label, it is strange that the privs would affect it. The form works perfectly with the super privs. Any suggestions?

One thing that comes to my mind: Did you give the control a “real” name or did you leave the name at its default (control181)? Usually, you need to give a control a name to be able to access it in your code.

Yes, I did enter a name, or you are right, you can’t control the visibility of the control.

Torolf, At the time of the OnInit trigger the code “can’t see” the form controls. Try moving your code to the OnOpenForm trigger. Chris.

In fact you don’t need your code on the OnInit or on OnOpenForm triggers… the only places you need to put it is onAfterGetRecord,onAfterGetCurrRecord and onNewRecord. Regards,

quote:


Originally posted by CMGW
At the time of the OnInit trigger the code “can’t see” the form controls. Try moving your code to the OnOpenForm trigger.


I thought about this too - but then: just why does the form work under super-user[?] Torolf, could you post your code here so we have more details?

Thanks for your help. I removed the code from the OnInit trigger, as suggested, and now it works. The explanation makes sense, but it is still a little strange that it works for super users, but not for other users. Here is the code: IF “Pro-Forma” THEN BEGIN CurrForm.EDITABLE := FALSE; CurrForm.ProformaReminder.VISIBLE := TRUE; END ELSE BEGIN CurrForm.EDITABLE := TRUE; CurrForm.ProformaReminder.VISIBLE := FALSE; END; “Pro-Forma” is a filed on the Sales Header table. ProformaReminder is the elusive control 181.