troubleshooting Question

Questions about DAO recordsets, tabledefs, and forms

Avatar of prophet001
prophet001 asked on
Microsoft AccessProgrammingMicrosoft Development
7 Comments1 Solution1040 ViewsLast Modified:
Hi,
 I am trying to get a grasp on what is going on with the code that I'm using to set a form's recordset property.
I have a form that has 2 text boxes. I am using these text boxes to get a start and end value and search for everything in between. (just numbers)
Here is how the code progresses:
1. The code runs a query and checks if any numbers exist between the two numbers given

2. If numbers exists it calls a function and passes the recordset to it for parsing.

3. The function will create another recordset based on a tabledef that has a line for each employee and the numbers they've been assigned. the numbers get formatted as ## - ##, ##, ##, ## - ## so that they are not all displayed

4. The function then returns its value as FUNCTIONNAME = rstResults.OpenRecordset

5. This recordset returned is then set to a subform's recordset property and displays the results

This does not seem to work without using Set form.recordset = recordResults.OpenRecordset. If i call it directly without OpenRecordset i get a runtime error 7965. Why is this?
Also, what relationship does the recordset returned by OpenRecordset have to the recordset it was called on? What relationship does the recordset returned by OpenRecordset have to the tabledef that the initial recordset was built on? What relationship does the initial recordset have to the tabledef it was built on.

Sorry to seem like i'm spamming questions but they are all trying to shed light on the same thing. What relationship does a DAO recordset have to a tabledef it was built from? I think there is some gaps in my understanding of this.
Thank you for any help and if you need clarification then I can try to explain better what I'm after.
Thank you,
 Preston
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 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 7 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