I know it is possible to call a SQL Server stored procedure and populate a recordset in Access VBA by using the sp like a method on an ADODB Connection object:
Dim cnnTest As New ADODB.Connection
Dim rsTest As New ADODB.Recordset
cnnTest.ConnectionString = strMyConnectionString
cnn.Open
cnn.procMyTestProcedure param1, param2, rsTest
This will call stored procedure procMyTestProcedure
passing prarmeters param1
and param2
, returning the results to my local rsTest
recordset. This all works fine and I have been using this technique for years. I have now come across a situation where I need to be able to pass a NULL as one of the parameters, but nothing I have tried so far seems to work. I have tried passing an empty string, the value Null and a local variable of type variant set to Null. None of these has worked. Does anyone know how to do this please? The parameter in the stored procedure is of type smalldatetime
.