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


Hi Robert,

how would this work for me, where I only want to create a SQL statement
as a string and execute it. Can it be that the string is not recognised
as SQL? (In my MSAccess days it worked). Here the run-time error
indicates that the "Object variable is not set" although it is valid
SQL text and works 'by hand'.

Cheers
Harvey 


On Wed, 2023-01-25 at 07:43 +0100, Robert Großkopf wrote:
Hi Harvey,

why do you want to use Access2Base?

Here a code from German Base Handbuch:

SUB ChangeData(oEvent AS OBJECT)
  DIM oConnection AS OBJECT
  DIM oForm AS OBJECT
  DIM stSql AS STRING
  DIM oSql_Statement AS OBJECT
  DIM inValue AS INTEGER
  oForm = oEvent.Source.Model.Parent
  oConnection = oForm.activeConnection()
  stSQL = oForm.getString(oForm.findColumn("SQL-Code"))
  inValue = MsgBox("Should SQL-Code" & CHR(13) & stSQL & CHR(13) &
"be executed?", 20, "Execute SQL-Code")
  IF inValue = 6 THEN
  oSQL_Statement = oConnection.createStatement()
  oSQL_Statement.execute(stSql)
  END IF
END SUB

SQL-Code is part of a table. Field in the table is "SQL-Code". Table
is 
datasource of a form. A button in this form will be enough to execute
the macro. You coud update, insert or delete rows by command
"execute".

Regards

Robert
-- 
Homepage: https://www.familiegrosskopf.de/robert




-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

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.