A query with fields from two tables

G

Guest

I am using a query twith fields from two tables. I am using most of the
fields from the first table and a sum of a field from the second table. When
the period for which I run the query retuns no records from the second table
the query shows no results although the first table should give some results.
I am using the results of this query in a report where I need some
information from the first table and a sumary of a field from the second
table.
Does anybody have any idea how I can get the fields of the first table and a
zero for the sumary of the field of the second table. I have tried to use the
nz function in different places but still with no success.
Thanks in advance.
Michalis
 
D

Duane Hookom

Double-click the join line in the query design view. Set the join properties
to show all the records from the first table.
 
G

Guest

Thank you very much for your responce Duane.
I should have mentioned that the two tables have no related fields.
If only I could make the sum of the field in that query give a zero outcome
when there are no records in the query the problem would be solved.
 
P

Peter R. Fletcher

How do you creata a meaningful Query from two unrelated Tables?

Thank you very much for your responce Duane.
I should have mentioned that the two tables have no related fields.
If only I could make the sum of the field in that query give a zero outcome
when there are no records in the query the problem would be solved.


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
G

Guest

The first table deals with the individual project expences of a constraction
company. The second table deals with the administration expences. In the
report for the individual project expences I want to have the summation of
the administrative expences as well, so as I can calculate the percentage of
the total expences.
 
P

Peter R. Fletcher

Ah. So what you want from the second Table is the total of
administrative expenses fro the period of the Query on the first
Table? Assuming that you have a Form to put in the start and end dates
for the Query (and if you don't, you should) and that you have a
button on that Form which makes it invisible and runs the Query, I
would add code to the button to step through the appropriate records
in the second Table, sum the expenses, and put the total in another
(hidden) control on the Form. Your query will then pull in start and
end dates and admin expenses totals from the Form and will only need
to look at the project expenses Table for the other data.

The first table deals with the individual project expences of a constraction
company. The second table deals with the administration expences. In the
report for the individual project expences I want to have the summation of
the administrative expences as well, so as I can calculate the percentage of
the total expences.


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 

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