D
Dale Fye
I'm trying to combine data from two different tables, to display them in a
single list. To exacerbate the problem, I am using Sharepoint Lists as my
data source, which may be causing some of the problems.
I've had a couple of challenges.
1) if I write the query with "Null as Org_ID" in the first part of the
union, then Access is interpreting that field as a string, and returns the
Ascii value of the Org_ID in the second part of the query, rather than the
actual numeric value. To resolve this, I'm setting the of that field, and
the LO_ID in the 2nd part to zero instead of Null. This will involve a
little more coding later, so if anyone can recommend a solution for this I'd
be happy to hear it.
2) Using the query below, Access is returning 4 fields, but their column
headings are LO_ID, ID, Field1, and Field2 instead of LO_ID, Org_ID, Field1,
and Field2. Any ideas why this is occuring?
Select LO_ID, Org_ID, Field1, Field2
FROM (
SELECT tbl_Learning_Objectives.LO_ID, 0 AS Org_ID,
tbl_Learning_Objectives.Learning_Objective as Field1, "" AS Field2, Sort_Order
FROM local_Parameters INNER JOIN tbl_Learning_Objectives ON
local_Parameters.DefaultYear = tbl_Learning_Objectives.PlanYear
UNION
SELECT 0 AS LO_ID, tbl_Organizations.ID AS Org_ID,
tbl_Organizations.Org_Abbr as Field1, tbl_Organizations.Org_Name as Field2,
NZ([Lab_Sort],99)*100+NZ([Org_Sort],99) as Sort_Order
FROM tbl_Organizations) as LOs_and_Orgs
ORDER BY Sort_Order, Field1
--
HTH
Dale
email address is invalid
Please reply to newsgroup only.
single list. To exacerbate the problem, I am using Sharepoint Lists as my
data source, which may be causing some of the problems.
I've had a couple of challenges.
1) if I write the query with "Null as Org_ID" in the first part of the
union, then Access is interpreting that field as a string, and returns the
Ascii value of the Org_ID in the second part of the query, rather than the
actual numeric value. To resolve this, I'm setting the of that field, and
the LO_ID in the 2nd part to zero instead of Null. This will involve a
little more coding later, so if anyone can recommend a solution for this I'd
be happy to hear it.
2) Using the query below, Access is returning 4 fields, but their column
headings are LO_ID, ID, Field1, and Field2 instead of LO_ID, Org_ID, Field1,
and Field2. Any ideas why this is occuring?
Select LO_ID, Org_ID, Field1, Field2
FROM (
SELECT tbl_Learning_Objectives.LO_ID, 0 AS Org_ID,
tbl_Learning_Objectives.Learning_Objective as Field1, "" AS Field2, Sort_Order
FROM local_Parameters INNER JOIN tbl_Learning_Objectives ON
local_Parameters.DefaultYear = tbl_Learning_Objectives.PlanYear
UNION
SELECT 0 AS LO_ID, tbl_Organizations.ID AS Org_ID,
tbl_Organizations.Org_Abbr as Field1, tbl_Organizations.Org_Name as Field2,
NZ([Lab_Sort],99)*100+NZ([Org_Sort],99) as Sort_Order
FROM tbl_Organizations) as LOs_and_Orgs
ORDER BY Sort_Order, Field1
--
HTH
Dale
email address is invalid
Please reply to newsgroup only.