I am using several ApplyFilter macros in a split form that is based on a query. They are working quite well except for a peculiar error in how one of them works.
I have a database of patients, and one of the fields is the diagnosis. You can see the list of patients in tbl_PatientsRecord below. Direct your attention to the patient highlighted in blue with the DiagnosisCategory of Tumor.
That value of "Tumor" is pulled from a table called tbl_DiagnosisCategory as seen below.
And you can see that after I enter the data through a forum, the two patients are correctly assigned to their respective categories.
I made a simple query that pulls data from tbl_PatientsRecord as well as another table (tbl_Surgeries) and set up a bunch of ApplyFilter macros. You can see the layout here in the split form:
When I select the Diagnosis Category combo box to select the various diagnoses, it pulls from tbl_DiagnosisCategory and then through a macro, filters the query/split form. This works for the most part with all the specified combo boxes you see. However, if I select CRSwNP as a diagnosis, you can see that after the update, there are two patients with two different DiagnosisCategory fields. The single patient with a DiagnosisCategory of "CRSwNP" shows up, but so does this patient with DiagnosisCategory of "Tumor."
If I select "Tumor" from this combo box, only the single patient with DiagnosisCategory of "Tumor" is shown.
The row source for the combo box is
Code:
SELECT [tbl_DiagnosisCategory].[DiagnosisCategoryID], [tbl_DiagnosisCategory].[DiagnosisCategory] FROM tbl_DiagnosisCategory ORDER BY [DiagnosisCategory];
Here is the actual macro:
The applyfilter macro uses the same syntax for all other combo boxes on this split form query, and so far, all of them seem to work...so far.
Thoughts on what may be causing this error? BTW, the original table tbl_PatientsRecord uses a "lookup" under the field DiagnosisCategory to get the data from tbl_DiagnosisCategory. (I realize using lookups at the table level is not preferred, but I thought I'd throw that one out there just in case it could be a possible cause of this error.)
Could it be that I have too many fields named "DiagnosisCategory" despite the fact that they are in different tables?
Thanks!