I create a cross tab sql based on a lot of situations in vba.
Now before I open a report based on this sql, I need another sql statement that shows distinct values of one of the fields.
My union query:
How can I write a SELECT query that shows Distinct SupplierFK from above sql?
If I save the union query as a query def, then I can use :
My problem is that I don't want to save the union query. It should be done on the fly in vba.
something like :
I hope it makes sense.
Any kind of advice is much appreciated.
Now before I open a report based on this sql, I need another sql statement that shows distinct values of one of the fields.
My union query:
Code:
UnionSql =
SELECT SupplierFK,QuotePK,
... other fields from first table .....
FROM tblQuotes
WHERE
.... where clause here .....
Union ALL SELECT
SupplierFK,
... other fields from Second table .....
FROM tblRequests
How can I write a SELECT query that shows Distinct SupplierFK from above sql?
If I save the union query as a query def, then I can use :
Code:
SELECT DISTINCT qryUnion.SupplierFK
FROM qryUnion;
My problem is that I don't want to save the union query. It should be done on the fly in vba.
something like :
sql = "SELECT DISTINCT SupplierFK FROM " & UnionSql
I hope it makes sense.
Any kind of advice is much appreciated.
Last edited: