[Base] Access2Base - Last version: 6.3

Discussions about using 3rd party extension with OpenOffice.org
JPL
Volunteer
Posts: 132
Joined: Fri Mar 30, 2012 3:14 pm

Re: [Base] Access2Base - Last version: 6.3

Post by JPL »

The Value property is not applicable to Field objects belonging to a TableDef or a QueryDef.
At the opposite it makes sense for Field objects belonging to a Recordset.

An approach can be something like:

Code: Select all

Dim db, query, rs
     Set db = Application.CurrentDb()
     Set query = db.QueryDefs("SELECTTD")
     sSql = Replace(query.SQL, "?", CStr(_RACINE))     '  _RACINE is presumed a number	
     Set rs = db.OpenRecordset(sSql)
Another approach, if you are searching for 1 field or 1 expression is to use

Code: Select all

     db.DLookup(...)
The domain argument may be a query name.
Kubuntu 22.04 / LibO 24.2
Access2Base (LibO).
BaseDocumenter extension (LibO)
ScriptForge (LibO)
Documentation on https://help.libreoffice.org/latest/en- ... bPAR=BASIC
gelinp
Posts: 35
Joined: Mon Oct 09, 2017 9:27 pm

Re: [Base] Access2Base - Last version: 6.3

Post by gelinp »

Ok, thank you for your response. So I understand that if I've got 2 or more field to replace I can use 2 or more time the Replace function because the left most "?" will be replaced once a time...
But it's not as prepared query because in a prepared query there is a compilation and an optimization if I call more than one time the prepared query, even with different parameters. And with this solution it's like a first time with each different parameter, isn't it ?
Libreoffice 6.4.6.2, Kernel: 5.4.0-52-generic x86_64 bits: 64
Desktop: Cinnamon 4.4.8 Distro: Linux Mint 19.3 Tricia
JPL
Volunteer
Posts: 132
Joined: Fri Mar 30, 2012 3:14 pm

Re: [Base] Access2Base - Last version: 6.3

Post by JPL »

Indeed it is not like a prepared statement in terms of performance, as far as the RDBMS optimizes such statements.
But, functionally, there is no difference.

The Replace() function has a Count argument to manage the number of wanted substitutions (https://help.libreoffice.org/master/en- ... 2551162491).

JPL
Kubuntu 22.04 / LibO 24.2
Access2Base (LibO).
BaseDocumenter extension (LibO)
ScriptForge (LibO)
Documentation on https://help.libreoffice.org/latest/en- ... bPAR=BASIC
Post Reply