E
efandango
I have a (complex) query that uses a [Run_No] for it's criteria, which when
entered, it finds any matching Run_No's (that are related via other
criteria). All works well, except I also get the inputted Criteria Run_No in
the result too. I want to be able to get all the other Run_No's but exclude
the original criteria input. Can this be done?
Here is the example of my QBE which I use to input the Criteria.
Field: Run_No
Table: B
Total: Where
Criteria: [Find Run No]
Here is the full QBE:
SELECT A.KeyCode, A.Run_No, A.Run_From, A.Run_To, A.Run_From_Postcode,
A.Run_To_Postcode, A.Run_Point_Venue_A, A.Run_Point_Address_A, B.Run_No AS
Run_No_Entry, B.Run_From_Postcode AS User_FromPCode, B.Run_To_Postcode AS
User_ToPCode, B.Run_From AS UserFrom, B.Run_To AS UserTo
FROM FindCodes AS A, FindCodes AS B
WHERE (((A.KeyCode)=.[Run_To_PostCode] Or
(A.KeyCode)=.[Run_From_PostCode]) AND ((B.Run_No)=[Find Run No]))
GROUP BY A.KeyCode, A.Run_No, A.Run_From, A.Run_To, A.Run_From_Postcode,
A.Run_To_Postcode, A.Run_Point_Venue_A, A.Run_Point_Address_A, B.Run_No,
B.Run_From_Postcode, B.Run_To_Postcode, B.Run_From, B.Run_To
ORDER BY A.Run_No;
entered, it finds any matching Run_No's (that are related via other
criteria). All works well, except I also get the inputted Criteria Run_No in
the result too. I want to be able to get all the other Run_No's but exclude
the original criteria input. Can this be done?
Here is the example of my QBE which I use to input the Criteria.
Field: Run_No
Table: B
Total: Where
Criteria: [Find Run No]
Here is the full QBE:
SELECT A.KeyCode, A.Run_No, A.Run_From, A.Run_To, A.Run_From_Postcode,
A.Run_To_Postcode, A.Run_Point_Venue_A, A.Run_Point_Address_A, B.Run_No AS
Run_No_Entry, B.Run_From_Postcode AS User_FromPCode, B.Run_To_Postcode AS
User_ToPCode, B.Run_From AS UserFrom, B.Run_To AS UserTo
FROM FindCodes AS A, FindCodes AS B
WHERE (((A.KeyCode)=.[Run_To_PostCode] Or
(A.KeyCode)=.[Run_From_PostCode]) AND ((B.Run_No)=[Find Run No]))
GROUP BY A.KeyCode, A.Run_No, A.Run_From, A.Run_To, A.Run_From_Postcode,
A.Run_To_Postcode, A.Run_Point_Venue_A, A.Run_Point_Address_A, B.Run_No,
B.Run_From_Postcode, B.Run_To_Postcode, B.Run_From, B.Run_To
ORDER BY A.Run_No;