Date questions in query

G

Guest

I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));
 
G

Guest

Karl thanks for your reply. The reason I have current rate in the employee
file is because I did not anticipate this problem when I designed the
employee file. The pay history table was an afterthought.
--
Tami


KARL DEWEY said:
I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


Tami said:
I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

Karl,
I put the statement "WHERE((([Pay History].[Start Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


KARL DEWEY said:
I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


Tami said:
I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

You say you put the WHERE statement 'on the criteria line pertaining to [Pay
History].[Hourly]' and got error.
There was no field named Hourly. The 'criteria line' sounds like you did it
in design view.
I am confused with what you did. Did you paste the SQL statement I post
into the SQL view?

Tami said:
Karl,
I put the statement "WHERE((([Pay History].[Start Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


KARL DEWEY said:
I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


Tami said:
I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

My query has the field called "Hourly Rate" from the Pay History table. When
I created the query as you recommended, I typed your WHERE statement in the
criteria for the Hourly Rate. I understood that the statement you gave me
would return the hourly rate whose beginning and ending dates were before and
after the job date. I did all of this in the design view of a query. I am not
familiar with SQL statements.
--
Tami


KARL DEWEY said:
You say you put the WHERE statement 'on the criteria line pertaining to [Pay
History].[Hourly]' and got error.
There was no field named Hourly. The 'criteria line' sounds like you did it
in design view.
I am confused with what you did. Did you paste the SQL statement I post
into the SQL view?

Tami said:
Karl,
I put the statement "WHERE((([Pay History].[Start Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


KARL DEWEY said:
I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


:

I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

When in design view click on the menu VIEW - SQL view and it opens another
window that has the SQL for the query. The SQL statement I posted would be
pasted in the window. Edited it for your exact field and table names. Check
for any hard returns that the posting and pasting may add such as spliting
field or table names that have a space. Sometimes a double quote is changed
to another character that looks almost the same.

Tami said:
My query has the field called "Hourly Rate" from the Pay History table. When
I created the query as you recommended, I typed your WHERE statement in the
criteria for the Hourly Rate. I understood that the statement you gave me
would return the hourly rate whose beginning and ending dates were before and
after the job date. I did all of this in the design view of a query. I am not
familiar with SQL statements.
--
Tami


KARL DEWEY said:
You say you put the WHERE statement 'on the criteria line pertaining to [Pay
History].[Hourly]' and got error.
There was no field named Hourly. The 'criteria line' sounds like you did it
in design view.
I am confused with what you did. Did you paste the SQL statement I post
into the SQL view?

Tami said:
Karl,
I put the statement "WHERE((([Pay History].[Start Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


:

I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


:

I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Gary Walter

PMFBI

{this might help}

Field: Start Date
Table: Pay History
Total:
Sort:
Show:
Criteria: <= [Job Costing].[Date]
or:

Field: End Date
Table: Pay History
Total:
Sort:
Show:
Criteria: >= [Job Costing].[Date]
or:

the 2 entries in the "Criteria" line
of the grid end up "constructing" the
WHERE clause which you can see
if you select "View/SQL View" from
the top menu in query designer...

Tami said:
My query has the field called "Hourly Rate" from the Pay History table.
When
I created the query as you recommended, I typed your WHERE statement in
the
criteria for the Hourly Rate. I understood that the statement you gave me
would return the hourly rate whose beginning and ending dates were before
and
after the job date. I did all of this in the design view of a query. I am
not
familiar with SQL statements.
--
Tami


KARL DEWEY said:
You say you put the WHERE statement 'on the criteria line pertaining to
[Pay
History].[Hourly]' and got error.
There was no field named Hourly. The 'criteria line' sounds like you did
it
in design view.
I am confused with what you did. Did you paste the SQL statement I
post
into the SQL view?

Tami said:
Karl,
I put the statement "WHERE((([Pay History].[Start
Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


:

I would not have Current Rate field in the Employee table. I would
have
EmployeeID in both the Job Costing and Pay History tables. The query
below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee
Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID
= [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay
History].[End
Date])>=[Date]));


:

I know this has been asked before, but I still can not figure out
how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on
the
Employee's table - Current Rate. This does not remain accurate due
to pay
increases. I wish for my Job Costing table to reflect past wages;
therefore I
created the Pay History table, but now I don't know how to create
the query
that determines which record in Pay History pertains to the date
worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

Karl,
I found the area you were speaking about and I pasted your SELECT statement.
When I ran the query, it did as it was susposed to do and calculated the
expense using the correct employee rate.

I have the form that works from this query as a subform on my job file, but
for some reason, it will not allow me to add records.

I appreciate all your help, and I appologize for not being able to grasp it
sooner.
--
Tami


KARL DEWEY said:
When in design view click on the menu VIEW - SQL view and it opens another
window that has the SQL for the query. The SQL statement I posted would be
pasted in the window. Edited it for your exact field and table names. Check
for any hard returns that the posting and pasting may add such as spliting
field or table names that have a space. Sometimes a double quote is changed
to another character that looks almost the same.

Tami said:
My query has the field called "Hourly Rate" from the Pay History table. When
I created the query as you recommended, I typed your WHERE statement in the
criteria for the Hourly Rate. I understood that the statement you gave me
would return the hourly rate whose beginning and ending dates were before and
after the job date. I did all of this in the design view of a query. I am not
familiar with SQL statements.
--
Tami


KARL DEWEY said:
You say you put the WHERE statement 'on the criteria line pertaining to [Pay
History].[Hourly]' and got error.
There was no field named Hourly. The 'criteria line' sounds like you did it
in design view.
I am confused with what you did. Did you paste the SQL statement I post
into the SQL view?

:

Karl,
I put the statement "WHERE((([Pay History].[Start Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


:

I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


:

I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

The query is for reporting - not adding records. You need a straight select
query to add records.

Tami said:
Karl,
I found the area you were speaking about and I pasted your SELECT statement.
When I ran the query, it did as it was susposed to do and calculated the
expense using the correct employee rate.

I have the form that works from this query as a subform on my job file, but
for some reason, it will not allow me to add records.

I appreciate all your help, and I appologize for not being able to grasp it
sooner.
--
Tami


KARL DEWEY said:
When in design view click on the menu VIEW - SQL view and it opens another
window that has the SQL for the query. The SQL statement I posted would be
pasted in the window. Edited it for your exact field and table names. Check
for any hard returns that the posting and pasting may add such as spliting
field or table names that have a space. Sometimes a double quote is changed
to another character that looks almost the same.

Tami said:
My query has the field called "Hourly Rate" from the Pay History table. When
I created the query as you recommended, I typed your WHERE statement in the
criteria for the Hourly Rate. I understood that the statement you gave me
would return the hourly rate whose beginning and ending dates were before and
after the job date. I did all of this in the design view of a query. I am not
familiar with SQL statements.
--
Tami


:

You say you put the WHERE statement 'on the criteria line pertaining to [Pay
History].[Hourly]' and got error.
There was no field named Hourly. The 'criteria line' sounds like you did it
in design view.
I am confused with what you did. Did you paste the SQL statement I post
into the SQL view?

:

Karl,
I put the statement "WHERE((([Pay History].[Start Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


:

I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


:

I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

Does that mean what I am trying to do is impossible?
--
Tami


KARL DEWEY said:
The query is for reporting - not adding records. You need a straight select
query to add records.

Tami said:
Karl,
I found the area you were speaking about and I pasted your SELECT statement.
When I ran the query, it did as it was susposed to do and calculated the
expense using the correct employee rate.

I have the form that works from this query as a subform on my job file, but
for some reason, it will not allow me to add records.

I appreciate all your help, and I appologize for not being able to grasp it
sooner.
--
Tami


KARL DEWEY said:
When in design view click on the menu VIEW - SQL view and it opens another
window that has the SQL for the query. The SQL statement I posted would be
pasted in the window. Edited it for your exact field and table names. Check
for any hard returns that the posting and pasting may add such as spliting
field or table names that have a space. Sometimes a double quote is changed
to another character that looks almost the same.

:

My query has the field called "Hourly Rate" from the Pay History table. When
I created the query as you recommended, I typed your WHERE statement in the
criteria for the Hourly Rate. I understood that the statement you gave me
would return the hourly rate whose beginning and ending dates were before and
after the job date. I did all of this in the design view of a query. I am not
familiar with SQL statements.
--
Tami


:

You say you put the WHERE statement 'on the criteria line pertaining to [Pay
History].[Hourly]' and got error.
There was no field named Hourly. The 'criteria line' sounds like you did it
in design view.
I am confused with what you did. Did you paste the SQL statement I post
into the SQL view?

:

Karl,
I put the statement "WHERE((([Pay History].[Start Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


:

I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


:

I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 
G

Guest

No, you use one query for entering the employee hours and a different one for
reporting on the cost of those hours.

Tami said:
Does that mean what I am trying to do is impossible?
--
Tami


KARL DEWEY said:
The query is for reporting - not adding records. You need a straight select
query to add records.

Tami said:
Karl,
I found the area you were speaking about and I pasted your SELECT statement.
When I ran the query, it did as it was susposed to do and calculated the
expense using the correct employee rate.

I have the form that works from this query as a subform on my job file, but
for some reason, it will not allow me to add records.

I appreciate all your help, and I appologize for not being able to grasp it
sooner.
--
Tami


:

When in design view click on the menu VIEW - SQL view and it opens another
window that has the SQL for the query. The SQL statement I posted would be
pasted in the window. Edited it for your exact field and table names. Check
for any hard returns that the posting and pasting may add such as spliting
field or table names that have a space. Sometimes a double quote is changed
to another character that looks almost the same.

:

My query has the field called "Hourly Rate" from the Pay History table. When
I created the query as you recommended, I typed your WHERE statement in the
criteria for the Hourly Rate. I understood that the statement you gave me
would return the hourly rate whose beginning and ending dates were before and
after the job date. I did all of this in the design view of a query. I am not
familiar with SQL statements.
--
Tami


:

You say you put the WHERE statement 'on the criteria line pertaining to [Pay
History].[Hourly]' and got error.
There was no field named Hourly. The 'criteria line' sounds like you did it
in design view.
I am confused with what you did. Did you paste the SQL statement I post
into the SQL view?

:

Karl,
I put the statement "WHERE((([Pay History].[Start Date])<=[Date])AND(([Pay
History].[End Date])>=[Date]))" on the criteria line pertaining to [Pay
History].[Hourly] and I get the message Undefined function 'WHERE' in
expression.

What am I doing wrong?
--
Tami


:

I would not have Current Rate field in the Employee table. I would have
EmployeeID in both the Job Costing and Pay History tables. The query below
will give you what want.

SELECT Employee.CenterID, Employee.DepartmentID, Employee.[Employee Name],
[Job Costing].JobID, [Job Costing].Date, [Job Costing].Hours, [Pay
History].[Hourly Rate], [Hourly Rate]*[Hours] AS [Job Cost]
FROM (Employee INNER JOIN [Job Costing] ON Employee.EmployeeID = [Job
Costing].EmployeeID) INNER JOIN [Pay History] ON Employee.EmployeeID = [Pay
History].EmployeeID
WHERE ((([Pay History].[Start Date])<=[Date]) AND (([Pay History].[End
Date])>=[Date]));


:

I know this has been asked before, but I still can not figure out how to do
it. Sorry,

I have three tables
Job Costing, Employee & Pay History

Job Costing Employee Pay History
JobID EmployeeID PayHistID
Date Employee Name Employee
Employee Current Rate Start Date
Hours End Date
Expense Hourly Rate

As of now my Job Costing table is calculating the Expense based on the
Employee’s table - Current Rate. This does not remain accurate due to pay
increases. I wish for my Job Costing table to reflect past wages; therefore I
created the Pay History table, but now I don’t know how to create the query
that determines which record in Pay History pertains to the date worked in
Job Costing. Can someone please help.
Thanks,
 

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