If you want the name to display then include the table that stores the name. It seems like you (or someone else) might have implemented lookup fields in your tables. Consider reading about the evils of lookup fields at http://access.mvps.org/access/lookupfields.htm.
Duane Hookom MVP
MS Access
----------------------------------------
> To: MS_Access_Professionals@yahoogroups.com
> From: ivi@co.sanmateo.ca.us
> Date: Mon, 12 Aug 2013 16:51:48 -0700
> Subject: [MS_AccessPros] Union Query MS Access 2010
>
> Hi All,
> I'm having some trouble with a display issue with a UNION query in MS Access 2010.
>
> I am getting all the expected results, but am not getting the value I want to display in one of the columns (Department). The results in the first column "Department" is correct, but it is displaying the RecordID number instead of the Department (Name). For example, instead of displaying "Youth Department" in the column "Department"...it is displaying the RecordID "14" which is the correct value, but I want the name or description of the value. When I run the two queries separately it works fine and returns the right value I'm looking for, but when I combine them in a UNION then it just displays the RecordID instead of the description (see my examples below). The field and data types in both queries are the same.
>
> My UNION query is based on two queries and NOT Tables.
>
>
>
>
>
> SELECT [QRY Department Transactions Summary].[Department], [QRY Department Transactions Summary].[Total Income], [QRY Department Transactions Summary].[Total Expense], [QRY Department Transactions Summary].[Total Balance Amount]
>
> FROM [QRY Department Transactions Summary]
>
> UNION
>
> SELECT [QRY WF Transactions Summary].[Department], [QRY WF Transactions Summary].[Total Income], [QRY WF Transactions Summary].[Total Expense], [QRY WF Transactions Summary].[Total Balance Amount]
>
> FROM [QRY WF Transactions Summary];
>
>
>
>
>
> Output results set currently displayed as:
>
> DepartmentTotal IncomeTotal ExpenseTotal Balance
> 14$0.00 ($29,140.00)($29,140.00)
> 14$11,825.00 ($230.00)$11,595.00
>
>
> Desired output results set:
>
> DepartmentTotal IncomeTotal ExpenseTotal Balance
> Youth Department$0.00 ($29,140.00)($29,140.00)
> Youth Department$11,825.00 ($230.00)$11,595.00
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (8) |
Tidak ada komentar:
Posting Komentar