Button that copies value from one text field to another

Creating and using forms
Post Reply
ArmatkaPL
Posts: 1
Joined: Sat Dec 20, 2014 5:13 pm

Button that copies value from one text field to another

Post by ArmatkaPL »

Hello!

I'm new to dbs and I've got question. I have to make a form that will allow me to add personal data of clients to database and for every single peron there are two addresses. One - home address and second - mailing address. A lot of times both will be identical so to avoid mistakes and save some time I'd like to make button that says "Home address same as mailing address" which will copy values from text fields home_street, home_city to mail_street, mail_city.

Will you help me out?
LibreOffice 4.1.2.3
Windows 7 Professional
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Button that copies value from one text field to another

Post by F3K Total »

Hi,
you can do that by adding a column e.g. same_address, boolean, default false.
If the mail address is the same as the home address, you check the checkbox bound to same_address,
In a query use casewhen e.g.like this:

Code: Select all

SELECT 
"ID", ... , 
casewhen( "same_address" = TRUE, "home_street", "mail_street" )as "mail_street", 
casewhen( "same_address" = TRUE, "home_city", "mail_city" )as "mail_city" 
...
Find an example attached. Try also to change the "c" to another letter or delete it then press filter
R
Attachments
Adressen_CP.odb
(71.97 KiB) Downloaded 126 times
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
Post Reply