- Local time
- Today, 12:54
- Joined
- Feb 28, 2001
- Messages
- 28,971
I'm having a problem and either my brain is fried (not impossible) or I'm missing something (also not impossible). The setup for this is complex, so bear with me. I am working on a complicated part of my Genealogy program, something to help me analyze structural errors in the family tree.
The specific problem I am addressing is the assignment of a person to a generation. It might be a bit pretentious but my generation is numbered 0. My parents are generation 1, grandparents generation 2, my step-kids are generation -1, and so on. This generation number is assigned by a really ugly stretch of code in which I look at the relationship between two people. The relationships are always either sibling, parent, spouse, or child. So if I find someone for whom I know their generation and have a relationship link to someone whose generation I DON'T know (yet), I can assign as either known person's generation +1 if relationship is parent, no change if spouse or sibling, or -1 if child. Simple enough. I've checked and it NEVER assigns a difference other than 1, 0, or -1 - so the problem isn't mechanical. The code that assigns this repeats sweeps through all combinations of <person 1, relation, person 2> - at least 28K combinations in total - until all generations are assigned or until anomalies show up.
As the analyzer proceeds, it finds LOTS of cases where generations on both sides are known, so it compares those cases. If it knows the relationship and the generations of both parties, it can test whether the generations are consistent. A huge percentage of the time, like 98%+, no problem. But sometimes I find a relationship between two people and their generation numbers not consistent with the relationship. This is an anomaly that means a parentage link is incorrect. It happens that sometimes the contributing sub-genealogies you get back can be faulty.
To identify the problematic generation assignment, I determine the path by which the generations were assigned. This is possible because each generational assignment gets logged as it is made. I can identify the step in which the generation was assigned for each person. To complete the analysis, I want to find an anomaly (i.e. two people with a relationship inconsistent with their generation) and step back through the generation logs for both sides of the relationship. This is where I have the problem.
I find the anomaly, then look at the two people and start tracing back the left-side partner (copying the relevant assignments along the way to the table that will drive the report) and then I want to go back to the same anomaly entry but start tracing the right-side partner's assignments. To achieve that, I have code that - before I start tracing EITHER side - I take a recordset clone from Me.Recordset into a separate DAO recordset object variable and I assure that the form's current bookmark goes into that recordset object. I start AND FINISH the left-side traceback, which DOES involve form navigation. In theory, all such traceback paths have to lead back to my record because it is the first record in the database.
At the point where I want to go back to the original anomaly, I copy the bookmark from the separate recordset back to the form's Me.Recordset.Bookmark - but it says "No current record."
No records ever get deleted by this analyzer but there are some updates to records to mark "USED" so that if there is ever a double-reference, I'll catch it. (So far, hasn't happened.) What is wrong with this approach to return the analyzer form back to the anomaly? At the moment I don't have record autonumbers because I wanted to avoid that particular bit of manipulation. If I have to do that, I will, but I was hoping to just bookmark where I wanted to return for subsequent analysis.
The specific problem I am addressing is the assignment of a person to a generation. It might be a bit pretentious but my generation is numbered 0. My parents are generation 1, grandparents generation 2, my step-kids are generation -1, and so on. This generation number is assigned by a really ugly stretch of code in which I look at the relationship between two people. The relationships are always either sibling, parent, spouse, or child. So if I find someone for whom I know their generation and have a relationship link to someone whose generation I DON'T know (yet), I can assign as either known person's generation +1 if relationship is parent, no change if spouse or sibling, or -1 if child. Simple enough. I've checked and it NEVER assigns a difference other than 1, 0, or -1 - so the problem isn't mechanical. The code that assigns this repeats sweeps through all combinations of <person 1, relation, person 2> - at least 28K combinations in total - until all generations are assigned or until anomalies show up.
As the analyzer proceeds, it finds LOTS of cases where generations on both sides are known, so it compares those cases. If it knows the relationship and the generations of both parties, it can test whether the generations are consistent. A huge percentage of the time, like 98%+, no problem. But sometimes I find a relationship between two people and their generation numbers not consistent with the relationship. This is an anomaly that means a parentage link is incorrect. It happens that sometimes the contributing sub-genealogies you get back can be faulty.
To identify the problematic generation assignment, I determine the path by which the generations were assigned. This is possible because each generational assignment gets logged as it is made. I can identify the step in which the generation was assigned for each person. To complete the analysis, I want to find an anomaly (i.e. two people with a relationship inconsistent with their generation) and step back through the generation logs for both sides of the relationship. This is where I have the problem.
I find the anomaly, then look at the two people and start tracing back the left-side partner (copying the relevant assignments along the way to the table that will drive the report) and then I want to go back to the same anomaly entry but start tracing the right-side partner's assignments. To achieve that, I have code that - before I start tracing EITHER side - I take a recordset clone from Me.Recordset into a separate DAO recordset object variable and I assure that the form's current bookmark goes into that recordset object. I start AND FINISH the left-side traceback, which DOES involve form navigation. In theory, all such traceback paths have to lead back to my record because it is the first record in the database.
At the point where I want to go back to the original anomaly, I copy the bookmark from the separate recordset back to the form's Me.Recordset.Bookmark - but it says "No current record."
Code:
...
Set rsCurAnomaly = Me.Recordset.Clone 'remember where we are
rsCurAnomaly.Bookmark = Me.Recordset.Bookmark 'save exact pointer
...
{code that steps through the relationships to find the given assignments}
...
Me.Recordset.Bookmark = rsCurAnomaly.Bookmark 'find original marker
No records ever get deleted by this analyzer but there are some updates to records to mark "USED" so that if there is ever a double-reference, I'll catch it. (So far, hasn't happened.) What is wrong with this approach to return the analyzer form back to the anomaly? At the moment I don't have record autonumbers because I wanted to avoid that particular bit of manipulation. If I have to do that, I will, but I was hoping to just bookmark where I wanted to return for subsequent analysis.