Hi all
I have a question regarding combining two queries into one that will do the same job.
I have created two access 97 queries:
The first (temp contacts) is designed to query a table [Contacts] for all fields where the patient number = a certain value
this works no problem.
The second query checks certain fields within the data returned from (temp contacts) and looks for duplication. It returns the fields that fit the criteria.
This also works.
The problem i have is that i want to return the values of the duplicateQuery as a recorset in VB.
Is it possible to combine the two queries into one so that i can do this.
I'm really struggling to figure it out.
All help is appreciated.
Thanks in advance
I have a question regarding combining two queries into one that will do the same job.
I have created two access 97 queries:
The first (temp contacts) is designed to query a table [Contacts] for all fields where the patient number = a certain value
Code:
SELECT CONTACTS.*, CONTACTS.PATIENT_NO
FROM CONTACTS
WHERE (((CONTACTS.PATIENT_NO)="tw885" Or (CONTACTS.PATIENT_NO)="ws440"))
this works no problem.
The second query checks certain fields within the data returned from (temp contacts) and looks for duplication. It returns the fields that fit the criteria.
Code:
SELECT DISTINCTROW [temp contacts].CONTACTS.PATIENT_NO, [temp contacts].DATE_OF_VISIT, [temp contacts].TIME_OF_VISIT, [temp contacts].CARE_PACKAGE, [temp contacts].STAFF_NO, [temp contacts].DISCIPLINE, [temp contacts].INTERVENTIONS, [temp contacts].LOCATION
FROM [temp contacts]
WHERE ((([temp contacts].DATE_OF_VISIT) In (SELECT [DATE_OF_VISIT] FROM [temp contacts] As Tmp GROUP BY [DATE_OF_VISIT],[TIME_OF_VISIT],[CARE_PACKAGE],[STAFF_NO],[DISCIPLINE],[INTERVENTIONS],[LOCATION] HAVING Count(*)>1 And [TIME_OF_VISIT] = [temp contacts].[TIME_OF_VISIT] And [CARE_PACKAGE] = [temp contacts].[CARE_PACKAGE] And [STAFF_NO] = [temp contacts].[STAFF_NO] And [DISCIPLINE] = [temp contacts].[DISCIPLINE] And [INTERVENTIONS] = [temp contacts].[INTERVENTIONS] And [LOCATION] = [temp contacts].[LOCATION])))
ORDER BY [temp contacts].DATE_OF_VISIT, [temp contacts].TIME_OF_VISIT, [temp contacts].CARE_PACKAGE, [temp contacts].STAFF_NO, [temp contacts].DISCIPLINE, [temp contacts].INTERVENTIONS, [temp contacts].LOCATION;
This also works.
The problem i have is that i want to return the values of the duplicateQuery as a recorset in VB.
Is it possible to combine the two queries into one so that i can do this.
I'm really struggling to figure it out.
All help is appreciated.
Thanks in advance