>Why have multiple databases? If you have multiple databases, then you have to manage the changing between them based on Company. I would add a field (companyid) to each table record key for the tables that are shared between the companies; i.e., the record key is now comprised of multiple fields (id and companyid). This key field will separate the records by company. Tables that are shared across companies; i.e., lookup tables, do not have the company key (unless each company can have a different configured list of values). Then create a custom property on _VFP as follows:
>
>
>ADDPROPERTY(_VFP, "CompanyId", "")
>
>
>Now set this property value for the current company. Then use this property value in the SELECT statements to retrieve the records that are applicable to the current selected company. This same functionality is used in SAP R/3 and S/4HANA to separate between client systems and has worked very well for decades.
That's what you do when you design for multi-company layout from square one. Which is usually not how it goes. You first have an app which some companies use for their own business. But then you find out that some of them have outsourced the part of work, covered by your app, to a third party. Doesn't matter whether that's just the ledger, payroll or whichever aspect of administration - soon this third party would want to use your app for multiple customers. Then you get to UT and begin a thread like this.