G
Geezer via AccessMonster.com
I think this is possible, but I can't seem to figure out how.
Here is some table structure information:
Surgery
ID (this is Subject ID not the PK)
Breast
Surg_Date
Surg_Type
Surg_Results
Code_breast_side
Code (relates to Surgery.Breast)
Breast_Side
Code_Surgery
Surgery_Code (relates to Surgery.Surg_Type)
Surgery_Code_Description
Code_Surgery_Diagnosis
Code_Surgery_Diagnosis (relates to Surgery.Surg_Results)
Code_Surgery_Diagnosis_Description
FollowupNotes
ID (relates one from here to many in Surgery)
Notes_HealthHX
I linked the above tables and ran an Update query to add comments to
FollowupNotes.Notes_HealthHX in the following format (for certain Surg_Types
only - 2, 3, 4, 5, and 5a):
[Surg_Date] & ", " & [Breast_Side] & ", " & [Surgery_Code_Description] & ", "
& [Code_Surgery_Diagnosis_Description]
The Update query worked well and seemed to add the appropriate comments in
the Notes_HealthHX field. There is now a comment for each specified
Surg_Type. Now, the users want all except one of these added comments
removed according to a specific logic. If Notes_HealthHX has more than one
comment for the same breast then leave the highest priority Surg_Type (the
priority order is 2, then 3, then 4, then 5, and finally 5a). Similarly, if
a Subject has more than one of the same Surg_Types, with different dates,
leave only the record with the most recent date. Below are some examples.
Current Notes_HealthHX:
2/4/2006, Right breast, Needle Biopsy, Ductal Insitu
6/25/2003, Right breast, Mastectomy, Normal
Desired Notes_HealthHX:
6/25/2003, Right breast, Mastectomy, Normal
Mastectomy is Surg_Type=2 so is a higher priority than Needle Biopsy, which
is Surg_Type=5. So I'd like to delete "2/4/2006, Right breast, Needle Biopsy,
Ductal Insitu" from Notes_HealthHX, but leave any other text currently in the
field there.
Current Notes_HealthHX example 2:
9/14/2003, Left breast, Mastectomy, Ductal Insitu
7/26/2002, Left breast, Mastectomy, Normal
4/17/2009, Left breast, Mastectomy, Invasive
Desired Notes_HealthHX example2:
4/17/2009, Left breast, Mastectomy, Invasive
Since there are multiple comments relating to the left breast, I want only
the one with the most recent date to remain.
Notes_HealthHX may contain additional comments in addition to those I added
with the Update query. I don't know how to search for a text string when I
don't know for sure what that string will be; I.E. I don't know the date, the
Surg_Type can be one of five, and the Surg_Results could be any of 17.
I would think the starting point would be to identify Notes_HealthHX records
with multiple strings in the format of the Update query, but how to identify
what gets replaced with "" is stumping me. Is this a Mid(), InStr(), LEN(),
or some combination? Also, since there may be additional text in the field,
I can't replace the entire contents of Notes_HealthHX, I want to just
replace/delete/remove the desired [date], [side], [type], [results] text.
Have I been at all clear about what I'm after? Is this doable? Thanks for
any insight!
Here is some table structure information:
Surgery
ID (this is Subject ID not the PK)
Breast
Surg_Date
Surg_Type
Surg_Results
Code_breast_side
Code (relates to Surgery.Breast)
Breast_Side
Code_Surgery
Surgery_Code (relates to Surgery.Surg_Type)
Surgery_Code_Description
Code_Surgery_Diagnosis
Code_Surgery_Diagnosis (relates to Surgery.Surg_Results)
Code_Surgery_Diagnosis_Description
FollowupNotes
ID (relates one from here to many in Surgery)
Notes_HealthHX
I linked the above tables and ran an Update query to add comments to
FollowupNotes.Notes_HealthHX in the following format (for certain Surg_Types
only - 2, 3, 4, 5, and 5a):
[Surg_Date] & ", " & [Breast_Side] & ", " & [Surgery_Code_Description] & ", "
& [Code_Surgery_Diagnosis_Description]
The Update query worked well and seemed to add the appropriate comments in
the Notes_HealthHX field. There is now a comment for each specified
Surg_Type. Now, the users want all except one of these added comments
removed according to a specific logic. If Notes_HealthHX has more than one
comment for the same breast then leave the highest priority Surg_Type (the
priority order is 2, then 3, then 4, then 5, and finally 5a). Similarly, if
a Subject has more than one of the same Surg_Types, with different dates,
leave only the record with the most recent date. Below are some examples.
Current Notes_HealthHX:
2/4/2006, Right breast, Needle Biopsy, Ductal Insitu
6/25/2003, Right breast, Mastectomy, Normal
Desired Notes_HealthHX:
6/25/2003, Right breast, Mastectomy, Normal
Mastectomy is Surg_Type=2 so is a higher priority than Needle Biopsy, which
is Surg_Type=5. So I'd like to delete "2/4/2006, Right breast, Needle Biopsy,
Ductal Insitu" from Notes_HealthHX, but leave any other text currently in the
field there.
Current Notes_HealthHX example 2:
9/14/2003, Left breast, Mastectomy, Ductal Insitu
7/26/2002, Left breast, Mastectomy, Normal
4/17/2009, Left breast, Mastectomy, Invasive
Desired Notes_HealthHX example2:
4/17/2009, Left breast, Mastectomy, Invasive
Since there are multiple comments relating to the left breast, I want only
the one with the most recent date to remain.
Notes_HealthHX may contain additional comments in addition to those I added
with the Update query. I don't know how to search for a text string when I
don't know for sure what that string will be; I.E. I don't know the date, the
Surg_Type can be one of five, and the Surg_Results could be any of 17.
I would think the starting point would be to identify Notes_HealthHX records
with multiple strings in the format of the Update query, but how to identify
what gets replaced with "" is stumping me. Is this a Mid(), InStr(), LEN(),
or some combination? Also, since there may be additional text in the field,
I can't replace the entire contents of Notes_HealthHX, I want to just
replace/delete/remove the desired [date], [side], [type], [results] text.
Have I been at all clear about what I'm after? Is this doable? Thanks for
any insight!