Employee time calculating and tracking

G

Guest

I am trying to put together a very simple database that will keep track of
employee hours and pay by month. I downloaded the module that allowed me to
create a query that calculates the amount the of hours from Start Time to End
Time but now I must multiply this amount by the Pay Rate to get the Total
Monthly Pay and I keep an getting error message. So, could you tell me how to
do this? Also, How do I automatically subtract 30 mins from the Start Time
and End Time total?
 
D

Douglas J. Steele

Without knowing the module you're using and how you're using, it's pretty
difficult for any of us to offer any suggestions.
 
J

John Vinson

I am trying to put together a very simple database that will keep track of
employee hours and pay by month. I downloaded the module that allowed me to
create a query that calculates the amount the of hours from Start Time to End
Time but now I must multiply this amount by the Pay Rate to get the Total
Monthly Pay and I keep an getting error message. So, could you tell me how to
do this? Also, How do I automatically subtract 30 mins from the Start Time
and End Time total?

Please post your code and the error message. They're rather hard to
see from this distance!

You can use an expression like

DateAdd("n", -30, <some expression>)

to subtract 30 minutes from a DateTime value, or if the expression
already returns an integer number of minutes, just subtract 30.

John W. Vinson[MVP]
 
G

Guest

Ok, I aplogize for the lack of detail.

Ultimately, I want a form that allows me to choose an employee from a
dropdown box and this choice will automatically place that employees pay rate
into the next box. Then, I want to be able to enter that employees time in
and time out information and have a choice of whether or not a lunch was
taken (lunch is 30 minutes) and get the Total hours worked this total would
then go into the total hours box. Next, the total hours box is totalled up
for the month and would be multiplied by the pay rate box to give the total
pay by month. I am using Sal Ricciardi's module posted Feb. 9, 2004 "On Time
and how much has elapsed" for
"Public Function HoursAndMinutes(interval As Variant) As String." I also
copied and pasted "Public Function ElapsedTimeString(dateTimeStart As Date,
dateTimeEnd As Date) As String" and "Public Function
ElapsedDays(dateTimeStart As Date, dateTimeEnd As Date) As String" but I dont
think I am using those last two. So, I have the total time by using the first
module, it returns the total time in hours and minutes format. Now I need to
subtract half an hour from that total if a lunch was taken, get the total
time by month and multiply that amount by the employee's pay rate.

I hope I was able to explain what I am after a little more clearly.
Thank you very much for your help.

Regards,

John
 
D

Douglas J. Steele

Do you have a URL for Sal's module? (or, better, paste the actual code here)

Also, what's the exact error message you're getting?
 
G

Guest

I get #error in the query box and then an invalid date value message if I
click on the filter results.

So, I need to know the correct expressions to subtract the 30 minute lunch
and then find the product of the hours and pay rate.

Heres the code for Sals' module:

Public Function HoursAndMinutes(interval As Variant) As String
'***********************************************************************
' Function HoursAndMinutes(interval As Variant) As String
' Returns time interval formatted as a hours:minutes string
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440)) ' 1440 = 24 hrs * 60 mins
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400)) ' 86400 = 1440 * 60 secs
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours & ":" & Format(minutes, "00")

End Function
Thanks Again, Oh btw, I consider myself a bit of a wine and beer geek as
well nice site....lol

John
 
D

Douglas J. Steele

How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case you're not
familiar with determining the SQL associated with a query, open the query in
Design view, then select SQL View from the View menu. Copy what appears into
your reply). Give some details about what the data types are in the
underlying table.
 
G

Guest

I am using the function to get the difference (or the total hours) between
the TimeOut and TimeIn columns and it reurns it as Expr1 in the query but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes I think it is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor, their pay
rate, a date, the time the contractor came in, the time they left, a place
for lunch (that is currently blank because I don't know how to format it) and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor takes one (I
would like this to be a yes/no and then automatically take out the 30 minutes
if yes) then total this up for the month and multiply that total by the pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts with my lack of
knowledge in this area, repetitive statements and stupid questions.

John
 
D

Douglas J. Steele

Realistically, the HoursAndMinutes function probably isn't going to be of
that much use to you, because it returns a string, so you won't be able to
use it in any calculations. Having it return a number is probably better:

Public Function HoursAndMinutes(interval As Variant) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes/60.0

End Function




--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Johnnie_on_the_Spot said:
I am using the function to get the difference (or the total hours) between
the TimeOut and TimeIn columns and it reurns it as Expr1 in the query but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes I think it is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor, their pay
rate, a date, the time the contractor came in, the time they left, a place
for lunch (that is currently blank because I don't know how to format it) and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor takes one (I
would like this to be a yes/no and then automatically take out the 30 minutes
if yes) then total this up for the month and multiply that total by the pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts with my lack of
knowledge in this area, repetitive statements and stupid questions.

John

Douglas J. Steele said:
How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case you're not
familiar with determining the SQL associated with a query, open the query in
Design view, then select SQL View from the View menu. Copy what appears into
your reply). Give some details about what the data types are in the
underlying table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message news:[email protected]... code
here) wrote
in employees
pay lunch
was 2004
"On I
also but
I using
the I
need the
total
keep
track Start
Time get
the the
Start
 
G

Guest

Thank You! That worked great.

But now how do I take out the half hour lunch?? It keeps taking out a full
hour instead of just a half hour... lol omg you gotta hate me...

John

Douglas J. Steele said:
Realistically, the HoursAndMinutes function probably isn't going to be of
that much use to you, because it returns a string, so you won't be able to
use it in any calculations. Having it return a number is probably better:

Public Function HoursAndMinutes(interval As Variant) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes/60.0

End Function




--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Johnnie_on_the_Spot said:
I am using the function to get the difference (or the total hours) between
the TimeOut and TimeIn columns and it reurns it as Expr1 in the query but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes I think it is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor, their pay
rate, a date, the time the contractor came in, the time they left, a place
for lunch (that is currently blank because I don't know how to format it) and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor takes one (I
would like this to be a yes/no and then automatically take out the 30 minutes
if yes) then total this up for the month and multiply that total by the pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts with my lack of
knowledge in this area, repetitive statements and stupid questions.

John

Douglas J. Steele said:
How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case you're not
familiar with determining the SQL associated with a query, open the query in
Design view, then select SQL View from the View menu. Copy what appears into
your reply). Give some details about what the data types are in the
underlying table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message I get #error in the query box and then an invalid date value message if I
click on the filter results.

So, I need to know the correct expressions to subtract the 30 minute lunch
and then find the product of the hours and pay rate.

Heres the code for Sals' module:

Public Function HoursAndMinutes(interval As Variant) As String
'***********************************************************************
' Function HoursAndMinutes(interval As Variant) As String
' Returns time interval formatted as a hours:minutes string
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440)) ' 1440 = 24 hrs * 60 mins
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400)) ' 86400 = 1440 * 60 secs
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours & ":" & Format(minutes, "00")

End Function
Thanks Again, Oh btw, I consider myself a bit of a wine and beer geek as
well nice site....lol

John

:

Do you have a URL for Sal's module? (or, better, paste the actual code
here)

Also, what's the exact error message you're getting?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message Ok, I aplogize for the lack of detail.

Ultimately, I want a form that allows me to choose an employee from a
dropdown box and this choice will automatically place that employees
pay
rate
into the next box. Then, I want to be able to enter that employees
time in
and time out information and have a choice of whether or not a lunch
was
taken (lunch is 30 minutes) and get the Total hours worked this total
would
then go into the total hours box. Next, the total hours box is
totalled up
for the month and would be multiplied by the pay rate box to give the
total
pay by month. I am using Sal Ricciardi's module posted Feb. 9, 2004
"On
Time
and how much has elapsed" for
"Public Function HoursAndMinutes(interval As Variant) As String." I
also
copied and pasted "Public Function ElapsedTimeString(dateTimeStart As
Date,
dateTimeEnd As Date) As String" and "Public Function
ElapsedDays(dateTimeStart As Date, dateTimeEnd As Date) As String" but
I
dont
think I am using those last two. So, I have the total time by using
the
first
module, it returns the total time in hours and minutes format. Now I
need
to
subtract half an hour from that total if a lunch was taken, get the
total
time by month and multiply that amount by the employee's pay rate.

I hope I was able to explain what I am after a little more clearly.
Thank you very much for your help.

Regards,

John

:

Without knowing the module you're using and how you're using, it's
pretty
difficult for any of us to offer any suggestions.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


"Johnnie_on_the_Spot"
<[email protected]>
wrote
in message
I am trying to put together a very simple database that will keep
track
of
employee hours and pay by month. I downloaded the module that
allowed
me
to
create a query that calculates the amount the of hours from Start
Time
to
End
Time but now I must multiply this amount by the Pay Rate to get
the
Total
Monthly Pay and I keep an getting error message. So, could you
tell me
how
to
do this? Also, How do I automatically subtract 30 mins from the
Start
Time
and End Time total?
 
D

Douglas J. Steele

I don't see anything in the function that takes out anything for lunch, and
I thought you said that the lunch field was currently blank because you
didn't know how to format it.

To be consistent with how Access stores time, you'd want to store the
half-hour lunch as 0.0208333 (1/48, since there are 48 half-hour periods in
a day)

Then, you could use HoursAndMinutes([TimeOut]-[TimeIn]-[Lunch])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Johnnie_on_the_Spot said:
Thank You! That worked great.

But now how do I take out the half hour lunch?? It keeps taking out a full
hour instead of just a half hour... lol omg you gotta hate me...

John

Douglas J. Steele said:
Realistically, the HoursAndMinutes function probably isn't going to be of
that much use to you, because it returns a string, so you won't be able to
use it in any calculations. Having it return a number is probably better:

Public Function HoursAndMinutes(interval As Variant) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes/60.0

End Function




--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message news:[email protected]...
I am using the function to get the difference (or the total hours) between
the TimeOut and TimeIn columns and it reurns it as Expr1 in the query but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes I think
it
is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor,
their
pay
rate, a date, the time the contractor came in, the time they left, a place
for lunch (that is currently blank because I don't know how to format
it)
and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor takes one (I
would like this to be a yes/no and then automatically take out the 30 minutes
if yes) then total this up for the month and multiply that total by
the
pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts with my
lack
of
knowledge in this area, repetitive statements and stupid questions.

John

:

How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case you're not
familiar with determining the SQL associated with a query, open the query in
Design view, then select SQL View from the View menu. Copy what
appears
into
your reply). Give some details about what the data types are in the
underlying table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot" <[email protected]>
wrote
in
message I get #error in the query box and then an invalid date value
message
if I
click on the filter results.

So, I need to know the correct expressions to subtract the 30
minute
lunch
and then find the product of the hours and pay rate.

Heres the code for Sals' module:

Public Function HoursAndMinutes(interval As Variant) As String
'***********************************************************************
' Function HoursAndMinutes(interval As Variant) As String
' Returns time interval formatted as a hours:minutes string
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440)) ' 1440 = 24 hrs * 60 mins
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400)) ' 86400 = 1440 * 60 secs
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the
minutes
and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours & ":" & Format(minutes, "00")

End Function
Thanks Again, Oh btw, I consider myself a bit of a wine and beer
geek
as
well nice site....lol

John

:

Do you have a URL for Sal's module? (or, better, paste the
actual
code
here)

Also, what's the exact error message you're getting?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
this
total give
the String."
I ElapsedTimeString(dateTimeStart
As String"
but Now
I get
the using,
it's will
keep from
Start to
get from
the
 
G

Guest

First of all thank you for all the help you have provided on this.

Now,where do I store the value for the half hour lunch? When I put it in the
default value in the table and then use the HourAndMinute expression in the
query it returns a number that is +24 instead of -.5. It seems to work better
by just using [Expr1]-[Lunch] except that it returns the subtraction of a
full hour instead of a half hour. Okay if I get this last little thing done I
will never bother you again I promise....

Douglas J. Steele said:
I don't see anything in the function that takes out anything for lunch, and
I thought you said that the lunch field was currently blank because you
didn't know how to format it.

To be consistent with how Access stores time, you'd want to store the
half-hour lunch as 0.0208333 (1/48, since there are 48 half-hour periods in
a day)

Then, you could use HoursAndMinutes([TimeOut]-[TimeIn]-[Lunch])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Johnnie_on_the_Spot said:
Thank You! That worked great.

But now how do I take out the half hour lunch?? It keeps taking out a full
hour instead of just a half hour... lol omg you gotta hate me...

John

Douglas J. Steele said:
Realistically, the HoursAndMinutes function probably isn't going to be of
that much use to you, because it returns a string, so you won't be able to
use it in any calculations. Having it return a number is probably better:

Public Function HoursAndMinutes(interval As Variant) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes/60.0

End Function




--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message I am using the function to get the difference (or the total hours) between
the TimeOut and TimeIn columns and it reurns it as Expr1 in the query but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract
Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes I think it
is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor, their
pay
rate, a date, the time the contractor came in, the time they left, a place
for lunch (that is currently blank because I don't know how to format it)
and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor takes one (I
would like this to be a yes/no and then automatically take out the 30
minutes
if yes) then total this up for the month and multiply that total by the
pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts with my lack
of
knowledge in this area, repetitive statements and stupid questions.

John

:

How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case you're not
familiar with determining the SQL associated with a query, open the
query in
Design view, then select SQL View from the View menu. Copy what appears
into
your reply). Give some details about what the data types are in the
underlying table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message I get #error in the query box and then an invalid date value message
if I
click on the filter results.

So, I need to know the correct expressions to subtract the 30 minute
lunch
and then find the product of the hours and pay rate.

Heres the code for Sals' module:

Public Function HoursAndMinutes(interval As Variant) As String

'***********************************************************************
' Function HoursAndMinutes(interval As Variant) As String
' Returns time interval formatted as a hours:minutes string

'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440)) ' 1440 = 24 hrs * 60
mins
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400)) ' 86400 = 1440 * 60 secs
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes
and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours & ":" & Format(minutes, "00")

End Function
Thanks Again, Oh btw, I consider myself a bit of a wine and beer geek
as
well nice site....lol

John

:

Do you have a URL for Sal's module? (or, better, paste the actual
code
here)

Also, what's the exact error message you're getting?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
wrote
in
message Ok, I aplogize for the lack of detail.

Ultimately, I want a form that allows me to choose an employee
from a
dropdown box and this choice will automatically place that
employees
pay
rate
into the next box. Then, I want to be able to enter that employees
time in
and time out information and have a choice of whether or not a
lunch
was
taken (lunch is 30 minutes) and get the Total hours worked this
total
would
then go into the total hours box. Next, the total hours box is
totalled up
for the month and would be multiplied by the pay rate box to give
the
total
pay by month. I am using Sal Ricciardi's module posted Feb. 9,
2004
"On
Time
and how much has elapsed" for
"Public Function HoursAndMinutes(interval As Variant) As String."
I
also
copied and pasted "Public Function ElapsedTimeString(dateTimeStart
As
Date,
dateTimeEnd As Date) As String" and "Public Function
ElapsedDays(dateTimeStart As Date, dateTimeEnd As Date) As String"
but
I
dont
think I am using those last two. So, I have the total time by
using
the
first
module, it returns the total time in hours and minutes format. Now
I
need
to
subtract half an hour from that total if a lunch was taken, get
the
total
time by month and multiply that amount by the employee's pay rate.

I hope I was able to explain what I am after a little more
clearly.
Thank you very much for your help.

Regards,

John

:

Without knowing the module you're using and how you're using,
it's
pretty
difficult for any of us to offer any suggestions.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


"Johnnie_on_the_Spot"
<[email protected]>
wrote
in message
I am trying to put together a very simple database that will
keep
track
of
employee hours and pay by month. I downloaded the module that
allowed
me
to
 
D

Douglas J. Steele

Do you need to store the lunch at all? If lunch is always 30 minutes, simply
deduct it from the total in HoursAndMinutes, so that the last line would be

HoursAndMinutes = (ours + minutes/60.0) - 0.5

If it's always 30 minutes, but they don't always take it, have a yes/no
field in the table to indicate whether or not they take lunch, and modify
the HoursAndMinutes function:


Public Function HoursAndMinutes( _
interval As Variant, _
AteLunch As Variant _
) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
' If AteLunch is True, deduct half an hour (0.5)
' from the total
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long
Dim booAte As Boolean

If IsNull(interval) = True Then Exit Function
If IsNull(AteLunch) = True Then booAte = False

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes / 60#
If AteLunch Then
HoursAndMinutes = HoursAndMinutes - 0.5
End If

End Function

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Johnnie_on_the_Spot said:
First of all thank you for all the help you have provided on this.

Now,where do I store the value for the half hour lunch? When I put it in the
default value in the table and then use the HourAndMinute expression in the
query it returns a number that is +24 instead of -.5. It seems to work better
by just using [Expr1]-[Lunch] except that it returns the subtraction of a
full hour instead of a half hour. Okay if I get this last little thing done I
will never bother you again I promise....

Douglas J. Steele said:
I don't see anything in the function that takes out anything for lunch, and
I thought you said that the lunch field was currently blank because you
didn't know how to format it.

To be consistent with how Access stores time, you'd want to store the
half-hour lunch as 0.0208333 (1/48, since there are 48 half-hour periods in
a day)

Then, you could use HoursAndMinutes([TimeOut]-[TimeIn]-[Lunch])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message news:[email protected]...
Thank You! That worked great.

But now how do I take out the half hour lunch?? It keeps taking out a full
hour instead of just a half hour... lol omg you gotta hate me...

John

:

Realistically, the HoursAndMinutes function probably isn't going to
be
of
that much use to you, because it returns a string, so you won't be
able
to
use it in any calculations. Having it return a number is probably better:

Public Function HoursAndMinutes(interval As Variant) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes/60.0

End Function




--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot" <[email protected]>
wrote
in
message I am using the function to get the difference (or the total hours) between
the TimeOut and TimeIn columns and it reurns it as Expr1 in the
query
but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract
Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes I
think
it
is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor, their
pay
rate, a date, the time the contractor came in, the time they left,
a
place
for lunch (that is currently blank because I don't know how to
format
it)
and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor
takes
one (I
would like this to be a yes/no and then automatically take out the 30
minutes
if yes) then total this up for the month and multiply that total
by
the
pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts with
my
lack
of
knowledge in this area, repetitive statements and stupid questions.

John

:

How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case
you're
not
familiar with determining the SQL associated with a query, open the
query in
Design view, then select SQL View from the View menu. Copy what appears
into
your reply). Give some details about what the data types are in the
underlying table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
60
secs beer
geek to
give format.
Now taken,
get pay
rate. module
that
 
G

Guest

Whew, Okay I pasted this revised code into the module and got rid of the old
one but now I get a compiler error and debugging errors and it pretty much
locks my machine up. Can you tell me how to write the new expression to get
the total hours and take out half an hour if they take a lunch?

Thanks,

John

Douglas J. Steele said:
Do you need to store the lunch at all? If lunch is always 30 minutes, simply
deduct it from the total in HoursAndMinutes, so that the last line would be

HoursAndMinutes = (ours + minutes/60.0) - 0.5

If it's always 30 minutes, but they don't always take it, have a yes/no
field in the table to indicate whether or not they take lunch, and modify
the HoursAndMinutes function:


Public Function HoursAndMinutes( _
interval As Variant, _
AteLunch As Variant _
) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
' If AteLunch is True, deduct half an hour (0.5)
' from the total
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long
Dim booAte As Boolean

If IsNull(interval) = True Then Exit Function
If IsNull(AteLunch) = True Then booAte = False

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes / 60#
If AteLunch Then
HoursAndMinutes = HoursAndMinutes - 0.5
End If

End Function

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Johnnie_on_the_Spot said:
First of all thank you for all the help you have provided on this.

Now,where do I store the value for the half hour lunch? When I put it in the
default value in the table and then use the HourAndMinute expression in the
query it returns a number that is +24 instead of -.5. It seems to work better
by just using [Expr1]-[Lunch] except that it returns the subtraction of a
full hour instead of a half hour. Okay if I get this last little thing done I
will never bother you again I promise....

Douglas J. Steele said:
I don't see anything in the function that takes out anything for lunch, and
I thought you said that the lunch field was currently blank because you
didn't know how to format it.

To be consistent with how Access stores time, you'd want to store the
half-hour lunch as 0.0208333 (1/48, since there are 48 half-hour periods in
a day)

Then, you could use HoursAndMinutes([TimeOut]-[TimeIn]-[Lunch])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message Thank You! That worked great.

But now how do I take out the half hour lunch?? It keeps taking out a full
hour instead of just a half hour... lol omg you gotta hate me...

John

:

Realistically, the HoursAndMinutes function probably isn't going to be
of
that much use to you, because it returns a string, so you won't be able
to
use it in any calculations. Having it return a number is probably
better:

Public Function HoursAndMinutes(interval As Variant) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes/60.0

End Function




--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message I am using the function to get the difference (or the total hours)
between
the TimeOut and TimeIn columns and it reurns it as Expr1 in the query
but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract
Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes I think
it
is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor,
their
pay
rate, a date, the time the contractor came in, the time they left, a
place
for lunch (that is currently blank because I don't know how to format
it)
and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor takes
one (I
would like this to be a yes/no and then automatically take out the 30
minutes
if yes) then total this up for the month and multiply that total by
the
pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts with my
lack
of
knowledge in this area, repetitive statements and stupid questions.

John

:

How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case you're
not
familiar with determining the SQL associated with a query, open the
query in
Design view, then select SQL View from the View menu. Copy what
appears
into
your reply). Give some details about what the data types are in the
underlying table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
wrote
in
message I get #error in the query box and then an invalid date value
message
if I
click on the filter results.

So, I need to know the correct expressions to subtract the 30
minute
lunch
and then find the product of the hours and pay rate.

Heres the code for Sals' module:

Public Function HoursAndMinutes(interval As Variant) As String

'***********************************************************************
' Function HoursAndMinutes(interval As Variant) As String
' Returns time interval formatted as a hours:minutes string

'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440)) ' 1440 = 24 hrs * 60
mins
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400)) ' 86400 = 1440 * 60
secs
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the
minutes
and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust
hours
HoursAndMinutes = hours & ":" & Format(minutes, "00")

End Function
Thanks Again, Oh btw, I consider myself a bit of a wine and beer
geek
as
well nice site....lol

John

:

Do you have a URL for Sal's module? (or, better, paste the
actual
code
here)

Also, what's the exact error message you're getting?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
<[email protected]>
wrote
in
message
Ok, I aplogize for the lack of detail.
 
D

Douglas J. Steele

The difference with the new function is that you need to pass two values to
it.

If you'd made Lunch a Yes/No field, you'd change:

HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1

to

HoursAndMinutes([TimeOut]-[TimeIn], [Lunch]) AS Expr1

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Johnnie_on_the_Spot said:
Whew, Okay I pasted this revised code into the module and got rid of the old
one but now I get a compiler error and debugging errors and it pretty much
locks my machine up. Can you tell me how to write the new expression to get
the total hours and take out half an hour if they take a lunch?

Thanks,

John

Douglas J. Steele said:
Do you need to store the lunch at all? If lunch is always 30 minutes, simply
deduct it from the total in HoursAndMinutes, so that the last line would be

HoursAndMinutes = (ours + minutes/60.0) - 0.5

If it's always 30 minutes, but they don't always take it, have a yes/no
field in the table to indicate whether or not they take lunch, and modify
the HoursAndMinutes function:


Public Function HoursAndMinutes( _
interval As Variant, _
AteLunch As Variant _
) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
' If AteLunch is True, deduct half an hour (0.5)
' from the total
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long
Dim booAte As Boolean

If IsNull(interval) = True Then Exit Function
If IsNull(AteLunch) = True Then booAte = False

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes / 60#
If AteLunch Then
HoursAndMinutes = HoursAndMinutes - 0.5
End If

End Function

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message news:[email protected]...
First of all thank you for all the help you have provided on this.

Now,where do I store the value for the half hour lunch? When I put it
in
the
default value in the table and then use the HourAndMinute expression
in
the
query it returns a number that is +24 instead of -.5. It seems to work better
by just using [Expr1]-[Lunch] except that it returns the subtraction of a
full hour instead of a half hour. Okay if I get this last little thing done I
will never bother you again I promise....

:

I don't see anything in the function that takes out anything for
lunch,
and
I thought you said that the lunch field was currently blank because you
didn't know how to format it.

To be consistent with how Access stores time, you'd want to store the
half-hour lunch as 0.0208333 (1/48, since there are 48 half-hour
periods
in
a day)

Then, you could use HoursAndMinutes([TimeOut]-[TimeIn]-[Lunch])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot" <[email protected]>
wrote
in
message Thank You! That worked great.

But now how do I take out the half hour lunch?? It keeps taking
out a
full
hour instead of just a half hour... lol omg you gotta hate me...

John

:

Realistically, the HoursAndMinutes function probably isn't going
to
be
of
that much use to you, because it returns a string, so you won't
be
able
to
use it in any calculations. Having it return a number is probably
better:

Public Function HoursAndMinutes(interval As Variant) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the
minutes
and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes/60.0

End Function




--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
wrote
in
message I am using the function to get the difference (or the total hours)
between
the TimeOut and TimeIn columns and it reurns it as Expr1 in
the
query
but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract
Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes
I
think
it
is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor,
their
pay
rate, a date, the time the contractor came in, the time they
left,
a
place
for lunch (that is currently blank because I don't know how to format
it)
and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor takes
one (I
would like this to be a yes/no and then automatically take out
the
30
minutes
if yes) then total this up for the month and multiply that
total
by
the
pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts
with
my
lack
of
knowledge in this area, repetitive statements and stupid questions.

John

:

How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case you're
not
familiar with determining the SQL associated with a query,
open
the
query in
Design view, then select SQL View from the View menu. Copy what
appears
into
your reply). Give some details about what the data types are
in
the
underlying table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
I get #error in the query box and then an invalid date value
message
if I
click on the filter results.

So, I need to know the correct expressions to subtract the 30
minute
lunch
and then find the product of the hours and pay rate.

Heres the code for Sals' module:

Public Function HoursAndMinutes(interval As Variant) As String

'***********************************************************************
' Function HoursAndMinutes(interval As Variant) As String
' Returns time interval formatted as a hours:minutes string

'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440)) ' 1440 = 24
hrs
* 60
mins
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400)) ' 86400 =
1440 *
60
secs
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the
minutes
and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust
hours
HoursAndMinutes = hours & ":" & Format(minutes, "00")

End Function
Thanks Again, Oh btw, I consider myself a bit of a wine
and
beer
geek
as
well nice site....lol

John

:

Do you have a URL for Sal's module? (or, better, paste the
actual
code
here)

Also, what's the exact error message you're getting?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
<[email protected]>
wrote
in
message
Ok, I aplogize for the lack of detail.
 
G

Guest

Thanks Doug !!

Everything works now!!

You were a great help,

John

Douglas J. Steele said:
The difference with the new function is that you need to pass two values to
it.

If you'd made Lunch a Yes/No field, you'd change:

HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1

to

HoursAndMinutes([TimeOut]-[TimeIn], [Lunch]) AS Expr1

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Johnnie_on_the_Spot said:
Whew, Okay I pasted this revised code into the module and got rid of the old
one but now I get a compiler error and debugging errors and it pretty much
locks my machine up. Can you tell me how to write the new expression to get
the total hours and take out half an hour if they take a lunch?

Thanks,

John

Douglas J. Steele said:
Do you need to store the lunch at all? If lunch is always 30 minutes, simply
deduct it from the total in HoursAndMinutes, so that the last line would be

HoursAndMinutes = (ours + minutes/60.0) - 0.5

If it's always 30 minutes, but they don't always take it, have a yes/no
field in the table to indicate whether or not they take lunch, and modify
the HoursAndMinutes function:


Public Function HoursAndMinutes( _
interval As Variant, _
AteLunch As Variant _
) As Single
'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5
' If AteLunch is True, deduct half an hour (0.5)
' from the total
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long
Dim booAte As Boolean

If IsNull(interval) = True Then Exit Function
If IsNull(AteLunch) = True Then booAte = False

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes / 60#
If AteLunch Then
HoursAndMinutes = HoursAndMinutes - 0.5
End If

End Function

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message First of all thank you for all the help you have provided on this.

Now,where do I store the value for the half hour lunch? When I put it in
the
default value in the table and then use the HourAndMinute expression in
the
query it returns a number that is +24 instead of -.5. It seems to work
better
by just using [Expr1]-[Lunch] except that it returns the subtraction of a
full hour instead of a half hour. Okay if I get this last little thing
done I
will never bother you again I promise....

:

I don't see anything in the function that takes out anything for lunch,
and
I thought you said that the lunch field was currently blank because you
didn't know how to format it.

To be consistent with how Access stores time, you'd want to store the
half-hour lunch as 0.0208333 (1/48, since there are 48 half-hour periods
in
a day)

Then, you could use HoursAndMinutes([TimeOut]-[TimeIn]-[Lunch])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message Thank You! That worked great.

But now how do I take out the half hour lunch?? It keeps taking out a
full
hour instead of just a half hour... lol omg you gotta hate me...

John

:

Realistically, the HoursAndMinutes function probably isn't going to
be
of
that much use to you, because it returns a string, so you won't be
able
to
use it in any calculations. Having it return a number is probably
better:

Public Function HoursAndMinutes(interval As Variant) As Single

'***********************************************************************
' Returns time interval formatted as hours.
' In other words, 8:30 will be returned as 8.5

'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400))
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes
and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours + minutes/60.0

End Function




--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
wrote
in
message I am using the function to get the difference (or the total hours)
between
the TimeOut and TimeIn columns and it reurns it as Expr1 in the
query
but
that is as far as I can get....

Here is what is in the SQL view for the query:

SELECT Contractors.ID, Contractors.Date, Contractors.[Contract
Specialist],
Contractors.[Pay Rate], Contractors.TimeIn, Contractors.TimeOut,
Contractors.Lunch, HoursAndMinutes([TimeOut]-[TimeIn]) AS Expr1
FROM Contractors;

As far as details about the underlying data in the table goes I
think
it
is
pretty self explanatory but it is entirely possible that I am
misunderstanding your question, there is a name of the contractor,
their
pay
rate, a date, the time the contractor came in, the time they left,
a
place
for lunch (that is currently blank because I don't know how to
format
it)
and
the Expr1 that returns the total hours between TimeIn and TimeOut.

I need to have a Total Time minus the lunch if the contractor
takes
one (I
would like this to be a yes/no and then automatically take out the
30
minutes
if yes) then total this up for the month and multiply that total
by
the
pay
rate to get a Total Pay by Month.

Thanks for dealing with me, I am sure I am driving you nuts with
my
lack
of
knowledge in this area, repetitive statements and stupid
questions.

John

:

How are you using Sal's function?

If it's in a query, what's the SQL for the query? (In case
you're
not
familiar with determining the SQL associated with a query, open
the
query in
Design view, then select SQL View from the View menu. Copy what
appears
into
your reply). Give some details about what the data types are in
the
underlying table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Johnnie_on_the_Spot"
<[email protected]>
wrote
in
message
I get #error in the query box and then an invalid date value
message
if I
click on the filter results.

So, I need to know the correct expressions to subtract the 30
minute
 

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