Assigning Subform record source from DAO query

I have the following code. Everything appears to work until this line:
Set Forms!TurtleMain!TurtleFeedingSub.Form.RecordSource = rsFeeding
I get an error '438' Object doesn't support this property or method.

Private Sub TurtleName_AfterUpdate()
     'Find the record that matches the control.
   
    Dim rs As Object
    Dim vTurtleID As Variant
    Dim dbs As Database
    Dim qdf As QueryDef
    Dim strSQL As String
    Dim rsFeeding As Object
    Dim dbsql As Database
   
   
   
     Set dbs = CurrentDb
 
 
  '  Set qdf = dbs.CreateQueryDef(strName, strSQL)
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[TurtleId] = " & Str(Nz(Me![TurtleName], 0))
    vTurtleID = Me![TurtleName]
    Set dbsql = DBEngine.Workspaces(0).OpenDatabase _
      ("", False, False, "ODBC;DRIVER=SQL Server Native Client 11.0;SERVER=WIN7DEV\SQLEXPRESS2012;UID=David Blankman;Trusted_Connection=Yes;DATABASE=TurtlesDB_beSQL;")
     
    strSQL = "spSubFeeding " & vTurtleID & " "
    Set rsFeeding = dbsql.OpenRecordset(strSQL, dbOpenSnapshot, dbSQLPassThrough)
Set Forms!TurtleMain!TurtleFeedingSub.Form.RecordSource = rsFeeding
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    TurtleChosen
   

           
   
 
   
End Sub
dblankmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
User RECORDSET, not RECORDSOURCE:

Set Forms!TurtleMain!TurtleFeedingSub.Form.RecordSet = rsFeeding
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dblankmanAuthor Commented:
That helps, but when I run the stored procedure from SSMS, I get 2200 records. When I run it inside Access it returns only one record.
0
dblankmanAuthor Commented:
Also, after I run the code once, it won't let me run it with another TurtleID. I thought that, perhaps, I should close the connection. I tried doing a dbsql.Close, but that seems to close the recordset as well.
0
dblankmanAuthor Commented:
Another thought that I had was defining the vTurtleID as a global variable and then assigning the recordset in the subform's onload event, although, I don't know if that would make any difference.
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Looks like you've asked the followup question here:

http://www.experts-exchange.com/questions/28758859/Access-PassThrough-Query-not-returning-correct-number-of-records.html

So you should close this one out, as it seems your original question was answered.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.