Ask Your Question
1

Data Base Field Duplicate shortcut key

asked 2018-11-14 01:04:20 +0100

mjeret gravatar image

I am new to Libre Office and am entering data into the database which will sometimes require the fields to be duplicated. Is there a shortcut key I can use for a field dup?

edit retag flag offensive close merge delete

Comments

+1 Good Q. I've given you enough points so that now you can attach images to your questions.

EasyTrieve gravatar imageEasyTrieve ( 2018-11-15 05:16:31 +0100 )edit

4 Answers

Sort by » oldest newest most voted
0

answered 2018-11-14 01:23:12 +0100

Ratslinger gravatar image

updated 2018-11-14 04:04:22 +0100

Hello,

Aside from the standard Copy/Paste method, you would need to write macros specific to your needs. Especially for someone "new" this is quite difficult.

For a sampling of this, you can download the sample from my answer in this post -> base auto populate new record. Personally don't think this is good practice.

Edit:

Just remembered another macro; see link in this post -> Base: Anyone have a Ctrl-tick macro to quickly copy from field above?

edit flag offensive delete link more
0

answered 2018-11-14 10:32:52 +0100

PhLo gravatar image

If I'm understanding the question right, there is a way to quickly duplicate a table row record when in table view (or when a table control is used within a form)...

As long as you have an autonumber primary key field set up, things should work as you would expect. I was excited to see this feature, mostly by accident a while back.

image description

edit flag offensive delete link more

Comments

Oh, I see... field duplicated, not record. My answer is probably for a different situation. When I'm designing forms, I like to drag an existing control and its label, and after dragging for a second, add CTRL to the drag, and a duplicate field is made. If you hold down SHIFT as well, the field will line up vertically or horizontally with the position of the original field, which is cool. Still maybe not the answer you were looking for, but maybe helpful to other beginners.

PhLo gravatar imagePhLo ( 2018-11-14 10:36:09 +0100 )edit
0

answered 2018-11-14 23:40:26 +0100

mjeret gravatar image

I thought there would be a simple answer to this question. i.e. MS Access uses the CTRL key with the key beside the central enter key " ' image description

edit flag offensive delete link more

Comments

There are a number of differences between Base and Access - this is one.

Ratslinger gravatar imageRatslinger ( 2018-11-14 23:56:02 +0100 )edit
0

answered 2018-11-15 05:45:04 +0100

EasyTrieve gravatar image

updated 2018-11-15 06:39:02 +0100

You're not the first one to ask this question.

Here is the code I use to do this.

If you are new to macros, you can study this and install it as a useful example of what can be done and how. It will obviously take some work for you to learn to set it up. But after you do it's relatively easy to give a given table control this functionality.

I hope someday to merge this feature into base for everyone to use, but for now this was the best solution I could come up with.

There are two parts. (Apologies for the wide code, but I don't like narrow editors. Cut and paste the code into a wide editor and look at it there.)

Also please note that because of a bug in the Ask.LibreOffice.org web site, single quotes (ticks) mess up the colors of the screen display for code. For simple code this has a workaround to put a closing quote at the end of comment lines. But for this code which specifically deals with single quotes, I just found it too confusing to use that workaround. So again cut and paste into your basic editor to inspect it.

Credits: I got part of this code from someone else who donated it, I think at the Open Office forum, and then have modified it as I saw fit.

I use this mostly on LO v 5.4. (Plan to upgrade to 6 someday when it's more stable.)


Part one is in any given database. It determines which fields in a given table control should not be copied. It looks something like this below. Note that this is for my accounting journal and for that I don't want the ID, Debit, Credit, or Balance fields duplicated, especially when + is used to copy a whole record.

image description

' === If Alt-' or Alt-+ (numeric) are hit, then quickly copy down info to new record ==============
Private Sub TableKeyPressedJournal(     oEvent as Object)   'CloneFieldOrRecord
    CloneFields.CloneFields(oEvent, Array("Journal ID", "Debit", "Credit", "Balance") ) 'List of fields to NOT record-copy
End Sub

Installed into your table contol here:

image description


Part two is common to all my databases.

image description

Option Explicit 'BASIC  ###### BASE TABLE CONTROL FIELD / RECORD COPY UTILITY ######

'Clone last field, or current record:
'
'   Select a field in any new or existing record and type the Alt' to copy the corresponding field to from its immediate predecessor; or
'   Select any existing record and type Alt+ (num pad) to clone the whole record to a new record.
'
'You can edit new data or abort the changes by pressing ESC before the record is saved.
'
'Issues:
' * An attempt to copy a Primary Key will cause an error when a new or modified record is saved.
' * A time-stamp column, or a time column linked to a time-stamp field in the database, may initially display incorrect times. 
'   The correct value, however, will be saved automatically and shown as soon as the new or modified record ...
(more)
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2018-11-14 01:04:20 +0100

Seen: 176 times

Last updated: Nov 15 '18