Macro code similar to MS Access

Creating Extension - Shared Libraries
Forum rules
For sharing working examples of macros / scripts. These can be in any script language supported by OpenOffice.org [Basic, Python, Netbean] or as source code files in Java or C# even - but requires the actual source code listing. This forum is not for asking questions about writing your own macros.

Macro code similar to MS Access

Postby longi » Sun Jul 10, 2016 10:10 pm

Hello!

First of all, I have to apologize about my English.
Secondly I have to apologize about the code.
I tried lots of times to get an Access simulation, without good results. The code here shown gets most of things I wanted. However, I tried to get a key combination for all forms you have in your database, so, I changed a bit the code, in order to have a wider use. (I put a button to launch the macro, but everyone is free to use the key combination that they want.)
The second thing is that I wanted to use it in all kind of controls at the same time, including subforms, so we have to avoid the use of the event.
I use an UnklDonald418’s macro to sail through all forms, subforms and controls, then I use the Arineckaig’s code for ‘normal controls’ and for ‘table controls’.
I’m conscious that something (or all) is wrong ( especially about ‘table controls’, in which it seems working, but the macro has to run through all controls several times).
It is possible to fix this code (my mess code) a bit?
Attachments
CONTROL X4.rar
(22.1 KiB) Downloaded 61 times
OpenOffice 4.2 on Windows 10 and Windows 7
LibreOffice 5.1 on Windows 10 and Windows 7
longi
 
Posts: 83
Joined: Mon Jul 15, 2013 5:04 pm

Re: Base Copy Field or Clone Record - Example

Postby UnklDonald418 » Mon Jul 11, 2016 7:23 pm

longi
The code you copied from my post recursively searches the Form Document for all the table controls. I was trying to use hasFocus() to determine which table to use when copying the data. Unfortunately, once a single grid element on a table is chosen hasFocus() always returns False.
By using an event Arineckaig's elegant code establishes which table to use without searching. The drawback is that each table must have an event defined for the macro to work on it. One of my original goals was to avoid having to use an event, but that appears to be impossible.
The bottom line is that by placing his code inside my recursive code you are attempting to copy data on every table on the Form Document.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the subject line
Apache OpenOffice 4.1.4 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 590
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Macro code similar to MS Access

Postby acknak » Mon Jul 11, 2016 8:43 pm

Split to new topic. Originally here: https://forum.openoffice.org/en/forum/v ... 21&t=83531

I had to guess at a title. Please change it or let me know if it should be changed.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22692
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3


Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 5 guests