Hello all,
I am working with a rather large database that references 10 other Access files. These files are referenced through linked tables in my database, and I am trying to create a union query with SQL that will select certain columns from all of the linked tables. I have the following code that works if all of the files the tables link to are present:
but if all of the files that link those tables aren't present in the source folder, my query won't run. Sometimes not all of the those files are needed because they will just take up valuable folder space.
Is there a way to check if the file that links to a certain table exists in the source folder and, if not, ignore the SELECT statement and move to the next one? I'm afraid I'm overthinking this problem.
Thank you in advance, and let me know if anymore information is need.
I am working with a rather large database that references 10 other Access files. These files are referenced through linked tables in my database, and I am trying to create a union query with SQL that will select certain columns from all of the linked tables. I have the following code that works if all of the files the tables link to are present:
Code:
SELECT StepNo, FailReason, Traceability, TestTeam, Date
FROM CALTR4Fails
UNION ALL
SELECT StepNo, FailReason, Traceability, TestTeam, Date
FROM CALTR6Fails
UNION ALL
SELECT StepNo, FailReason, Traceability, TestTeam, Date
FROM DIAGTR4SysFails
...etc
but if all of the files that link those tables aren't present in the source folder, my query won't run. Sometimes not all of the those files are needed because they will just take up valuable folder space.
Is there a way to check if the file that links to a certain table exists in the source folder and, if not, ignore the SELECT statement and move to the next one? I'm afraid I'm overthinking this problem.
Thank you in advance, and let me know if anymore information is need.