I have lately received this error “The Sales Header does not exist” a couple of times in Navision 2009.
First I thought this was caused by a filter not being reset on the form – but I got wiser.
Suddenly I noticed a pattern.
I got the error every time I “played” with Sales Invoices / Sales Quotes in one company and then changed to another company. If I now tried to use Sales Invoice / Sales Quotes etc I received the error.
After trying using RESET, SELECTLATESTVERSION etc. – I figured out that Navision didn’t clear all values during the change. The Odd thing was that first I got the error; it keept anoying me until I deleted the user’s zup file.
So what to do?
I found out that if a record already exists in the Sales Header table, you will not get the error. So you can either keep an empty record in the table or add it when opening the form.
I don’t like empty records! So I went with the last solution and used some code similar to this:
SH.RESET; SH.SETRANGE(SH."Document Type",SH."Document Type"::Quote); IF SH.COUNT = 0 THEN BEGIN SH."Document Type" := SH."Document Type"::Quote; SH.INSERT(TRUE); END;
The code was added on OpenForm on Form 41 “Sales Quote”. Similar code was also added to the forms 42 “Sales Order”, 43 “Sales Invoice” and 44 “Sales Credit Memo”.
After this I did not get the error anymore 🙂