"query.open" cannot compile


I have a NAV 2016 whitch cannot compile some of my code.

it could compile beform upgrade (NAV 2015)

When I write himQuery.open; and then I try to save and compile it throw an syntax error on last char of methode.

I have tryed to recompeil the queries, and creating them from scratch, but I still am getting the same syntax error.


If I use a standard query it works perfekt, but my custom query do not work

Do any of you have any ideas of what I can do to fix it?

  • Hi,

    Check if you have missed any End statement in rest of your code. Sometimes CAL doesn't necessarily point out the exact place where the error is..

    Also include query.CLOSE statement.
  • In reply to Sowkarthika:

    Thanks for your response, I have checked for missing end statement plus if I remove til HIMQuery.open. it can compile as it should but unfortunately I cannot use the data from the query without it.

    I have tried the close too, but as you can see the error is still there.

    Thanks for your response, do you have any other ideas ?


  • In reply to Lars Sander:

    Hi ,
    Check your Query - Your whole code is using HIMQuery2 but you are closing HIMQuery1.
  • Hi,

    Check if in your query have a field with name OPEN, if exists, change the name of the field.

    Hope this help
  • The problem turned out to be that the on NAV 2015 when you created a query it could handle a field called open but after the upgrade to 2016 it thought that when I called "queryName.Open" it was the field not the methode.

    So because the query was created, copyed and so on from a NAV 2015 it had a default name of open in one of the field in the tabel, and therefore I could not call the metode Open();.
    Thanks for all your feedback