Hello.
I'm writing an application that has many tables of the same purpose/class [tblRecordsOrg1], [tblRecordsOrg2], etc.
I would like to create a general purpose query that will select one of these tables depending on a control value, and will function as a base to other, more specific quieries.
So far I came up with this:
But this isn't enough because the number of columns could change in the future.
Any ideas on a solution?
Thanks a bunch.
I'm writing an application that has many tables of the same purpose/class [tblRecordsOrg1], [tblRecordsOrg2], etc.
I would like to create a general purpose query that will select one of these tables depending on a control value, and will function as a base to other, more specific quieries.
So far I came up with this:
Code:
SELECT DISTINCT IIf(Form!MyForm!MyControl=1,[tblRecordsORG1].[Column1],[tblRecordsORG2].[Column1]) AS Column1, IIf(Form!MyForm!MyControl=1,[tblRecordsORG1].[Column2],[tblRecordsORG2].[Column2]) AS Column2, IIf(Form!MyForm!MyControl=1,[tblRecordsORG1].[Column3],[tblRecordsORG2].[Column3]) AS Column3....
FROM tblRecordsORG1, tblRecordsORG2;
But this isn't enough because the number of columns could change in the future.
Any ideas on a solution?
Thanks a bunch.