Query question

G

Guest

Hello,

I have a query question. My db looks something like this:

Table/Fields/
Employee/Emp ID/Other employee information
Hours/Date/#of hours
Meetings/Date/#of hours
Training/Date/#of hours

All tables are related using a primary key called Emp_ID. I am trying to
create a query that will display the total number of meeting hours for each
employee for the current month. This I can do fine, but if an employee does
not have any meeting hours logged for the current month then I want the sum
to be 0. In other words I still want to display the Employee information but
with the 0 meetings hours recorded for the current month.

If I manually create an entry into the meeting table for each employee every
month then I can get what I want, but this is time consuming. Any help would
be appreciated.

Thanks.
 
E

Edward G

use the Nz function in an expression in your totals query
Nz function looks like this:
Nz([YourField],0)
Tells Access if value is null, display zero. (Value after the comma is what
will be displayed).
You will be calculating something like this:
Nz([YourField],0)+Nz([AnotherField],0)
 
G

Guest

It is likely that your SQL statement currently joins the Employee table to
the Meetings table using an INNER JOIN. If you were to change this to an a
LEFT (or RIGHT) JOIN, you should get the results you require e.g.

FROM Employee LEFT JOIN Meetings ON Employee.[Emp Id] = Meetings.[Emp Id]

If you are not familiar with SQL and use the Query Design, click on the line
joining the two tables and select Join Properties from the drop-down menu,
then select the option that gives all rows from Employee

Hope This Helps
Gerald Stanley MCSD
 

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