Problems with dates in query

T

Tony Williams

Here is my sql
SELECT Clients.ClientID, Clients.CompanyName, [FirstName] & " " & [LastName]
AS Manager, Projects.ProjectID, Projects.ProjectName, [Time Card
Hours].BillableDays, [Time Card Hours].BillingRate, [Time Card Hours].VAT,
[Time Card Hours].DateWorked, Invoices.InvNbr, Invoices.InvDate,
Invoices.BeginDate, Invoices.EndDate
FROM ((Employees RIGHT JOIN Projects ON Employees.EmployeeID =
Projects.EmployeeID) INNER JOIN (Clients INNER JOIN Invoices ON
Clients.ClientID = Invoices.ClientNbr) ON (Clients.ClientID =
Projects.ClientID) AND (Projects.ProjectID = Invoices.ProjectNbr)) INNER
JOIN [Time Card Hours] ON Projects.ProjectID = [Time Card Hours].ProjectID;

This should be giving me the days worked relating to the appropriate Invoice
Nbr. However it is giving me ALL the days worked for the Project ID against
each invoice.
Can anyone help me here? Watch extra information do you need?
TIA
Tony
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You don't have a WHERE clause to filter the SELECT to just the invoice
number you want. Add:

WHERE Invoices.InvNbr = [Invoice Number?]

When the query runs the above will produce a pop-up parameter input
dialog box. Enter the invoice number you want and hit Enter.

If the InvNbr data type is Text add this line at the top:

PARAMETERS [Invoice Number?] Text;

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQm6sZoechKqOuFEgEQJq1gCfWERyAA3gOgTJsJ1JCbKL5kUscH0An1ma
71QTDLE+CLZrD+elAFqbD3fs
=4nhd
-----END PGP SIGNATURE-----
 
T

Tony Williams

Thanks that worked just fine
Tony
MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You don't have a WHERE clause to filter the SELECT to just the invoice
number you want. Add:

WHERE Invoices.InvNbr = [Invoice Number?]

When the query runs the above will produce a pop-up parameter input
dialog box. Enter the invoice number you want and hit Enter.

If the InvNbr data type is Text add this line at the top:

PARAMETERS [Invoice Number?] Text;

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQm6sZoechKqOuFEgEQJq1gCfWERyAA3gOgTJsJ1JCbKL5kUscH0An1ma
71QTDLE+CLZrD+elAFqbD3fs
=4nhd
-----END PGP SIGNATURE-----

Tony said:
Here is my sql
SELECT Clients.ClientID, Clients.CompanyName, [FirstName] & " " &
[LastName] AS Manager, Projects.ProjectID, Projects.ProjectName, [Time
Card Hours].BillableDays, [Time Card Hours].BillingRate, [Time Card
Hours].VAT, [Time Card Hours].DateWorked, Invoices.InvNbr,
Invoices.InvDate, Invoices.BeginDate, Invoices.EndDate
FROM ((Employees RIGHT JOIN Projects ON Employees.EmployeeID =
Projects.EmployeeID) INNER JOIN (Clients INNER JOIN Invoices ON
Clients.ClientID = Invoices.ClientNbr) ON (Clients.ClientID =
Projects.ClientID) AND (Projects.ProjectID = Invoices.ProjectNbr)) INNER
JOIN [Time Card Hours] ON Projects.ProjectID = [Time Card
Hours].ProjectID;

This should be giving me the days worked relating to the appropriate
Invoice Nbr. However it is giving me ALL the days worked for the Project
ID against each invoice.
Can anyone help me here? Watch extra information do you need?
 

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