Changing BackColor of form dynamically

One of our clients wants us to have the background color of the G/L, Purchases & Payables, etc. menu forms to be blue for one company and pink for another company so that at anytime it is very obvious to the user what company they are in. Is there a way to change the background color of the menu form (for that matter any form) dynamically through code? I see that there is a command UPDATEFORECOLOR but that is used only with form controls, not the form itself (and that too only the forecolor, not backcolor). Please advise. Pari Somasundaram

Some advise… don’t do it. Anything you do with colors will be unwseable, and eventually the client (long after they have forgotten the original reason) will want it back to normal. Instead, add a control to the main menu in a large font with the source expression COMPANYNAME, this works very well.

Hi somasundaram, If you do not have any problem in the future to and customer is confirmed upon the colours go ahead and change dynamically alternatively put a caption as Company name when ever the user uses that form.he can see at caption for cross check Regards Jaganath

Hi Jags, I am confused.As per my understanding I can not change form colour dynamically through code.If it is possible, can you post the code.

Hi Rajesh, One way is to create 2 control exactly the same on one of the controls use the back color and the other a different back color. In the form code Use the Currform.control.visible property to hide and unhide the control based on the record or variables. Mind you, COding on forms is not very advisable. But if the customer cannot live without it… [:0]

Programming should not be considered a substitute for training, but as Jags says, it is your client, so please feel free to wreck havoc on them.[}:)] PS Advise is only valuable if you take it.[;)]

Hello Pari what David is trying to say is (I’ll interprete it for you if you are busy) is: There is a restricted number or colours available in Navision, but you can run an unlimted number of companies. So useing a different colour per company is technically impossible. Instead, take the good advice having a BIG textbox showing the company name on the main menu. Pelle

Hey Pelle that’s it exactly.[:D]

Hi Prashant, We can think so many work around solution for a problem not a problem.But my query was only to know that we can change the FORM colour dynamically through code, what Jags posted in query -------------- If you do not have any problem in the future to and customer is confirmed upon the colours go ahead and change dynamically -------------- I was eager to know, really it is possible.

We can control the colour dynamically as explained below. The best solution is use two controls as a frame for Example Frame controls say Control1,Control2 For “company1” set “Control1” Visible and For “Company2” Set “Control2” visible. SET Control1 back colour= red, Control2 back colour= blue Put all your necessary Command buttons required for each company on the respective Frame control

Hi Jags, Really iritating.Again work around solution.My question is straight forward “CAN WE CHANGE THE FORM COLOUR DYNAMICALLY?”. I hope it would be clear.


Hi Rajesh, Not possible for a form dynamically