troubleshooting Question

How to set RecordSource for sub form

Avatar of dblankman
dblankman asked on
Microsoft AccessVisual Basic Classic
3 Comments1 Solution138 ViewsLast Modified:
I have inherited an access application front and backend and am converting it to sql server backend.
The code that opens a form is:  [MainSub].SourceObject = "TurtleMain". This form in turn has  several subforms. I have code like this to get records for each of the subforms:

Set rsFeeding = New ADODB.Recordset
With rsFeeding
   Set .ActiveConnection = con
   .Source = "spSubFeeding " & vTurtleID & " "
   .LockType = adLockOptimistic
   .CursorType = adOpenKeyset
   .CursorLocation = adUseClient
End With

I want to be able to set the Recordset for the subform, but the code: Set Forms!Main!MainSub.Form!TurtleFeedingSub.Recordset = rsFeeding gives me an error of "object doesn't support this property or method."

What is the correct way to set the Recordset property?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros