I would like to have the property (background color) of a control (list box for example) change (upon form refresh) based on a number (ex: 1=red, 2=green, etc). This number is the result of a SQL snippet (which currently works) counting the number of rows in a table.
After looking for an easy solution, I'm now afraid that my only solution will be to turn to macros to do this, right? If so, any help would be appreciated, because macros is a very obscure world to me.
Thank you all!
[Solved] Change control property based on SQL output
-
- Posts: 20
- Joined: Sun May 14, 2017 3:48 am
[Solved] Change control property based on SQL output
Last edited by 1gatomontes on Tue Oct 17, 2017 8:57 pm, edited 1 time in total.
OpenOffice 4.1.2
Windows 10 (v.1607)
Windows 10 (v.1607)
Re: Change control property based on SQL output
Formatted controls behave like spreadsheet cells with numbers.
F1-help on number format codes wrote:[BLUE][<0]#,0 "°C";[RED][>30]#,0 "°C";[BLACK]#,0 "°C"
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 20
- Joined: Sun May 14, 2017 3:48 am
Re: Change control property based on SQL output
Thanks Villeroy, but this is too limited (up to 3 codes only) for our purpose, or am I getting the limitation wrong?
OpenOffice 4.1.2
Windows 10 (v.1607)
Windows 10 (v.1607)
Re: Change control property based on SQL output
Yes. Seems to be so. A macro could do the trick for single controls. Nothing can not colour individual lines in a grid control.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Volunteer
- Posts: 1549
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Change control property based on SQL output
I was recently working on a project that needed something similar to what you are asking so I put together a little demonstration of how a macro might work to solve your problem. The macro would probably need further massaging but at least it is a starting point.
- Attachments
-
- DemoColorByValue.odb
- (14.13 KiB) Downloaded 131 times
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11