Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


Hi Allan,

With the help of Andrew and Alex, you may have solved your problem by now.
But if not, I run lots of SQL commands in my Base applications and I could
post the Basic code I use, if that was likely to be of any use to you.

Noel
--
Noel Lodge
lodgemn@gmail.com


On 29 August 2014 19:32, Alex Thurgood <alex.thurgood@gmail.com> wrote:

Le 28/08/2014 13:46, Allan Newton a écrit :

Hi Allan,


However if I create blank form with just one button and set the
properties
of that button to

run the macro it fails at the line

 if IsNull(ThisComponent.CurrentController.ActiveConnection) then

 with the error message

 "BASIC runtime error.

Property or method not found: ActiveConnection."



Can anyone help me please?

That error message is telling you (or should be telling you) that you
have no Database Context. ActiveConnection is instantiated via a
database connection context :


http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sdbc_1_1XConnection.html

so the macro in your form has to create such a context before
ActiveConnection can return any value.

As you don't say whether your form has been made within your ODB file,
or whether it is independent, it is hard to help out much further.
Generally, if the form is created within the ODB file, the connection
context is initiated upon opening the main ODB interface, whereas an
independent form needs to establish the connection context first. If
your form is within the ODB file, then one of the reasons why the
connection context might not be found is because it needs to walk up the
window hierarchy to find the main or parent. As far as I know, this has
always been a weakness of the CurrentComponent method within Base
containers where child form windows do not automatically inherit the
connection context. Andrew has indicated a way of obtaining the
connection context from by walking up the Model hierarchy of the
Database container.


From a quick read, the answer to your problem seems to have been
published here :

https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=42882#p198477


Alex





--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems?
http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be
deleted



-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.