Default Value in Form

Creating and using forms
Post Reply
parkrunner
Posts: 2
Joined: Sat Nov 22, 2008 5:32 pm

Default Value in Form

Post by parkrunner »

I'm new to OO, but I had extensive experience with databases on large systems (Oracle, Ingres, Sybase, Rdb, Interbase, Progress) 15 years ago.

I've created a little database for our hiking club along with the forms to manually enter the data. 3 of the 4 tables are relatively stable. Once populated they will maybe grow 5% to 10% a year. The 4th table has only 4 columns but will grow every week with up to 100 to 150 rows. I want to make the data entry into this table as easy and fast as possible. Each column in the table is associated with a text box on the form. When entering data into the form, how do I set the default value equal to the value of the previous row that was entered?

For example... I have 4 columns, say A, B, C, and D, and 100 rows to enter. The user starts up the form and enters the first row with values W, X, Y and Z. Now, 10 seconds, later, he is about to enter data into the form again for the second row. The values he want to enter are W, X, G, and H. (In real life the data value will NOT be single character, they will be 6 to 12 characters long.) How do I design the form so that the default value for column A is W and the default value for column B is X, as those are the values entered in the previous row?

Then after entering 20 rows where the values for column A and B are all identical but C and D are different, the user enters 15 more rows where A and B are the same for those 15 but different from the first 20. Again I'd like the default value to be equal the value entered in the previous row. 20 years ago I worked with a database form tool where this was a snap to do, just specify in the form a default value of <prev>. Can this be done in OO Base?
OOo 3.0.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Default Value in Form

Post by Villeroy »

This requires scripting (macros) using quite a painful API. This macro Base - Copy column and copy row functions can do the trick. However, it is written in Basic which makes things even more complicated since the current Base version can not integrate such macros. You have to install the code in a application wide hierarchy of Basic libraries and modules as described in [Tutorial] How to install a code snippet.
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
Post Reply