SQL report problem

E

erick-flores

Hello all

I am creating an Expense Report. There are to types of expenses:
Company expenses and Reimb Expeneses. The company expenses is under
"Expense Details Co" table and Reimb Expenses is under "Expense
Details" table. So I am creating this final report to see both type of
expenses separately but I CANT.
I got this report design from a website, but it only came with one
"Expense Details" table, so I add the Expense Details Co. The report
worked fine with only Expense Details but now that I am trying to add
the other table it wont work quite well for my final report.
Here is the SQL stat. that I am using to display the report, but again,
is not working the way I want.
I want to see in one group the Expense Details and on other group the
Expense Details Co.

SELECT DISTINCTROW [Expense Reports].*, [Expense
Details].ExpenseDetailID, [Expense Details].ExpenseItemAmount, [Expense
Details].ExpenseItemDescription, [Expense Details].ExpenseDate,
[Expense Categories].ExpenseCategory, Employees.EmployeeNumber,
Employees.FirstName, Employees.LastName, [Expense Details
Co].[EnpenseDetailID Co], [Expense Details Co].[ExpenseItemAmount Co],
[Expense Details Co].[ExpenseItemDescription Co], [Expense Details
Co].[ExpenseDate Co]
FROM (Employees INNER JOIN ([Expense Reports] INNER JOIN [Expense
Details Co] ON [Expense Reports].ExpenseReportID = [Expense Details
Co].[ExpenseReportID Co]) ON Employees.EmployeeID = [Expense
Reports].EmployeeID) INNER JOIN ([Expense Categories] RIGHT JOIN
[Expense Details] ON [Expense Categories].ExpenseCategoryID = [Expense
Details].ExpenseCategoryID) ON [Expense Reports].ExpenseReportID =
[Expense Details].ExpenseReportID
WHERE ((([Expense Reports].ExpenseReportID)=[forms]![Expense
Reports]![ExpenseReportID]));

I am almost sure that I have something wrong in the SQL but I dont know
where exactly..please help me

Thank you
 
J

Jerry Whittle

Possibly you need a UNION ALL query to show all the records from both tables.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top