# \[REPORTS\] Problems with COMPANYNAME and the Reques

**URL:** <https://www.dynamicsuser.net/t/reports-problems-with-companyname-and-the-reques/9437>\
**Category:** Developers Forum\
**Created:** [December 1, 2004, 12:07pm UTC](https://www.dynamicsuser.net/t/reports-problems-with-companyname-and-the-reques/9437 "2004-12-01T12:07:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaLPiTaTioN](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@PaLPiTaTioN](https://www.dynamicsuser.net/u/PaLPiTaTioN)\
**Post date:** [December 1, 2004, 12:07pm UTC](https://www.dynamicsuser.net/t/reports-problems-with-companyname-and-the-reques/9437/1 "2004-12-01T12:07:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ahed4](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@ahed4](https://www.dynamicsuser.net/u/ahed4)\
**Post date:** [December 1, 2004, 12:57pm UTC](https://www.dynamicsuser.net/t/reports-problems-with-companyname-and-the-reques/9437/2 "2004-12-01T12:57:34Z")

</div>

Have you checked the property “SaveValues” on the request form? I guess it stores the last chosen company there …

---

<div class="post-metadata">

**Author:** ![PaLPiTaTioN](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@PaLPiTaTioN](https://www.dynamicsuser.net/u/PaLPiTaTioN)\
**Post date:** [December 1, 2004, 1:25pm UTC](https://www.dynamicsuser.net/t/reports-problems-with-companyname-and-the-reques/9437/3 "2004-12-01T13:25:36Z")

</div>

It’s amazing, but it works! I have made dozens of this kind of reports and the problem never occurred, until now. And now it seems that only these two reports have SaveValues set. Thank you!
