Form Desgin with Menu button

I can you help me

i am working on Nav 4 sp2

I have an existing form with a menu button, this button has 2 options which print 2 different reports.

each report uses the Onpush Action to do the following:

Subcontract.SETRANGE(“No.”, “No.”);
REPORT.RUNMODAL(REPORT::“Subcontractor Order Lab only”, FALSE, FALSE, Subcontract);

this works for both reports fine.

I have just added a new option which prints off another report using the same code ie:

Subcontract.SETRANGE(“No.”, “No.”);
REPORT.RUNMODAL(REPORT::“Subcontractor new report”, FALSE, FALSE, Subcontract);

However i get a error when saving the form that “unknown Variable”

am i missing something?

Welcome to DUG [:)]

Can you show us whole error message…

If it is related to SubContract then check whether the variable is declared as global varialbe or local variable?

You are right the error is to “Subcontract” and i do not have this variable defined Globaly or Locally

But the our reports run and this variable is not set.

i looks like i am missing where the variable is set for the other reports.

and thanks for you help


go back to the place where previous code is written and click view–>Cal Locals

Select variables

check whether you have Name definied with Subcontract…copy the line and paste it in your code at same place and try,


I have look at the code but there are on variables Defined for “subcontracts” and when I look at the Local variables under the view menu “C\AL Locals” this is not editable.

Thanks you your help again

May be you are checking under Parameters tab

you should check under Variables tab of cal locals…


Thanks for your help on this, you where correct, i was not in the code area when i checked for Local Variables

I have added the Local Variable to my code and it is working fine.

Thanks again for you help!!!

Regards Danny[:D]

Welcome [:)]

Please verify the post(s) which solved your problem.