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?