How to execute funcion named Test1 that is stored in PostgreSQL from VBA code?
For example. We have function definition as follow:
CREATE OR REPLACE FUNCTION "public"."Test1" (
)
RETURNS bit AS
$body$
BEGIN
INSERT INTO test ("name") VALUES ('1');
RETURN 1;
END;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;
Now I'm trying to execute this function it that way:
Function TestCall()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strSQl As String
strSQl = "SELECT * FROM Test1();"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQl, dbOpenDynaset, dbSeeChanges)
'this doesnt work as well: syntax error'
dbs.Execute strSQl
If Not (rst.BOF And rst.EOF) Then
do some work here
End If
End Function
But I'm getting Syntax Error near FROM. I have no idea how to execute this. Thanks in advance.