was trying to create a delete query. was able to use the command sql line to delete records from a table but notable to save te sql delete syntax in a query delete like what is avaible in ms access
Yes, base unlike access does not support action queries directly, workaround is to call your statement via macro which can be run via event, code or button
eg
Sub delA
oConn = ThisDatabaseDocument.DataSource.getConnection("","")
SQL = "DELETE FROM ""tblcountry"" WHERE ""item"" = 'Austria' "
oQuery = oConn.createStatement()
oQuery.executeQuery(SQL)
End Sub
base unlike access does not support action queries directly
depends upon the database used. For example just tested the DELETE
statement using PostgreSQL and even though it displayed a message, the statement executed with Run SQL command directly
on in the Query section.
Hello,
Base, like Access, is not a database. It is a front end to any number of databases. LibreOffice is delivered with two databases - HSQLDB embedded and Firebird embedded (currently needs experimental features turned on) databases. You can use many others.
SQL, especially Select statements, can be saved and executed in the Query section. SQL for updating, such as your delete statement, can be stored there also but in many cases needs to be run from Tools->SQL
. You can store in Query section by turning on from the toolbar icon or from menu Edit
, Run SQL command directly
. For this storage use SQL view.
I am using the embedded HSQLDB database.
So the immediate answer is no; you cannot create a delete query. You can only execute a delete from the SQL command statement. Am I understanding this correctly?
I would need to create a function with sql and call it from a form button as an example?
Thx
Roland
Again, just to be clear. You can create and store it in a query using SQL View. In the Case of HSQLDB embedded you cannot execute it from there. Use either Tools->SQL or run from a macro.
Other databases do allow some execution from Query section with Run SQL command directly
turned on.