Some of my reports contain the following code:
[GLOBAL VARS]
sCompany: text[60];
[REQUEST FORM]
textbox, SourceTable = Company, SourceExpr = sCompany; // <-- creates a combo box
[OnInitReport]
sCompany := COMPANYNAME
What does this code do?
It places a combo box with all companies in our Navision implementation and sets the default shown company to the value of COMPANYNAME, the variable that holds the chosen working company in Navision.
Why?
In OnPreReport, I use the selected company as a filter on the report. If no company is chosen (the value of sCompany is '') the report shows data from all companies.
What is the problem?
In two of my reports, the default selected value of the combo box is set to the right company in design mode, but when the report is run from a form (thus not test-running), the value of the textbox doesn't seem to change. If always shows the name of the first company that was chosen after switching from another database.
Question.
Can anybody tell me what could be the problem here? It really drives me nuts.
Comments