Questions about DAO recordsets, tabledefs, and forms
Posted on 2010-11-10
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.