Run Time Error 7965 when displaying recordset in a sub form

R

Robin9876

In an Access form that is calling a stored procedure with the
parameter string defined in VBA and the results displayed in a sub
form. When searching by name it works correctly, however when
searching by a date it displays the following error message.

Run-time error '7965':
The object you entered is not a valid recordset property.

This occurs on the set recordset line below.

Set rs = CreateObject("ADODB.recordset")
rs.CursorLocation = adUseClient

rs.Open "mySP " & ParamStr, conn

Set Me.mySubForm.Form.Recordset = rs


However using the generated parameter string from SQL Management
Studio the data was returned.

Does anybody know why it is working with some parameters yet when it
does not work in Access the generated SQL statement works within the
SQL Server tools?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top