I drawed a form in LibreOffice Base with a control proposing several dates (formatted in the table as DATE): once selected one, a macro is charged to insert this date as a WHERE clause in a SQL script.
Script is extract from a generic query (“qListaUtenti_perRPT”), modified and saved in a new query (“qPerRPT_TMP”).
The task is performed, no errors when the macro runs, but when I launch the new query, the result is even “Incorrect data type”.
The problem is I don’t know which is the right syntax to use for the date itself.
I tryed including the date in quotes, double quotes, hash symbol…
Below an example:
Sub StampaSchedaData (poEvent As Object)
Dim oConnexion as Object, ocCombo1 As Object, sSQL As String
oConnexion = poEvent.Source.Model.Parent.ActiveConnection
Set ocCombo1 = Events(poEvent).Source
sSQL = oConnexion.queries.getByName("qListaUtenti_perRPT").Command
sSQL = sSQL & " AND ""00_DATI_UTENTE"".""DATA_INS"" = '" & ocCombo1.Value & "'"
oConnexion.queries.getByName("qPerRPT_TMP").Command = sSQL
End Sub
Thank’s in advance for any help!