Thank you very much for your interest and help, there is a lot to be digested here for an amateur...
The code suggested by June7 fails with a runtime error 3146, odbc call failed, at the set rst= dbs.openrecordset("query4"). I can add that,if you have to make direct reference to the stored procedure by name, you can use this code bypassing Access completely
Code:
Dim cnn As ADODB.Connection
Dim Cmd1 As ADODB.Command
Dim rs As ADODB.Recordset
Dim data1 As Date, data2 As Date
Dim sQry As String, dim strFilePath as String
strFilePath = "C:\TestHyp4"
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
'cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & strFilePath & "\nuovodbricevute.accdb;"
cnn.Open "DSN=driver18NuovoDB32" 'connection dsn to sql server database
' Create Command Object.
Set Cmd1 = New ADODB.Command
Cmd1.CommandType = adCmdStoredProc
Cmd1.ActiveConnection = cnn
Cmd1.CommandText = "dbo.spPrimaNotaAP" ' stored procedure name
data1 = #12/31/2023#
data2 = #1/1/2025#
' Create Parameter Object.
'Add parameters to stored proc
Cmd1.Parameters.Append Cmd1.CreateParameter("data1", adDBDate, adParamInput, 0, Format(data1, "YYYY/MM/DD"))
Cmd1.Parameters.Append Cmd1.CreateParameter("data2", adDBDate, adParamInput, 0, Format(data2, "YYYY/MM/DD"))
' Open Recordset Object.
rs.Open Cmd1
Set Cmd1 = Nothing
Set cnn = Nothing
This code works ok and does not use Access pass through query.
I will continue experimenting. Again thank you all