Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timesheet Entry

Status
Not open for further replies.

charanch

Programmer
Jan 3, 2004
55
US
Hello, I have a timekeeing application that "they" want to change. At first there were only a few users, but now there are more users and somebody has cheated. Right now I have a form pulling from a table with the following fields:

time_in
time_out
task
job number

The time_in box has a drop down with a list of hours starting at 6:00 a.m. and the time_out is the same way. There were only a few users and they'd just round up and choose the in and out hours from a dropdown. Now I have to change it to a "start" button that will record the current time in the time_in field and when they go to a new record, it's supposed to automatically record the current time in the time_out field. I can handle the start time ok, but how do I handle the automatic posting of the stop time? Many thanks in advance for any ideas.
 
Since users manually "start" logging time for a task, they would have to manually "stop" logging time for the currently selected task, I would think.



< M!ke >
 
charanch...

I had a similiar problem...

Create a new table with users id, record indicator and a booleen value if they clocked out.

When they try to clock in.. before update...
check to see if they clocked out of a previous record.

If they didn't either display a message, or update the clocked out time with the current time using the record indicator...

When they clock out, I delete these indicators...
DB will grow in size rather quickly if you do not compact it regularly.

Hope this gives you some ideas...

Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Yes, it does. Thanks to both...

If I were to put a stop button on there, how will I suppress the next new record until they click the stop button?

On another note, so there's no way to automatically have it post the stop time in the previous record when they start the next record?

I'm trying to avoid training issues and cheating here. That's why I would like not to have a stop button.

Thanks again!
 
Just trying to steer clear of that dangerous word "assume," but you could decide that the first thing that happens when they click Start is that any currently opened task is stopped using the system time, then set the start time for whatever new task/job is selected....

I've been through a timekeeping app or 5 myself and they present more of a challenge than you'd first think.

What if the user starts the same task twice in a row? What if they go to lunch and forget to change tasks? Or leave for the day/vacation and your app's still running?

Best implementation I've had for something like this? Let the user select date, start time, end time, task, and job and fill out the timesheet app on a daily/weekly basis.

I understand the "cheating" issue, but I've never figured out how to write a program that makes people honest (that, I believe, should be a management issue).

Best of luck!

< M!ke >
 
charanch...

Lets get a few questions asked....

1. Is this a network based db or does it run on a single users PC. I'm assuming this a networked db...

2. What are the users doing...
charanch said:
At first there were only a few users, but now there are more users and somebody has cheated.

3. Is there any login form?

4. Will a task or job number have multiple entries within a day, if so will it/can it be by multiple users?

5. What is the primary key in the table?

LNBruno said:
I've been through a timekeeping app or 5 myself and they present more of a challenge than you'd first think.
I AGREE 100%

If its a single record at a time, which I doubt... Then
Click Event Code for start button..
Code:
DoCmd.GoToRecord , , acPrevious
If Me.timEnd.Value = "" Then
    Me.timEnd.Value = Rnd(Time)
End If
DoCmd.GoToRecord , , acNew
'Your start button code here

If you do a search on google for access timecard samples you should find a function that will convert the time to a value like what you created in the drop down.
I'll try to help out best I can, and provide some code samples if needed. I look for an old copy of the db I created in Access97.

Good Luck
Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Hi All, many thanks for your thoughts and questions. The application is networked. It's been running since 2002. The users are estimators in a construction company. I agree to just leave it like it is -- I really don't know how I'd keep somebody from cheating. They do have to log in. It's a daily timesheet. Access Guru I will take a look at some samples and I'll try the code snippet, but I also agree with LNBruno on the management issue to defy cheating. Maybe I can talk them into just leaving it alone! Thanks again!!

 
There are several options...

** What is cheating....Are they just forgetting to put the end time in before they start the new job?

** Will a task or job number have multiple entries within a day, if so will it/can it be by multiple users? Then most important, Does each User use their OWN PC... Reason I ask, there is an EASY fix, based on this answer.

Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
charanch,

I found the code I created for a Timecard app to adjust the time.

Create a new module, and paste the following.
Code:
Function fEditTime(varTime As Variant) As Variant
'Usage - MsgBox "The adjusted time would be " & fEditTime(Time)
'Usage - Me.Text1 = fEditTime(Time)
'Purpose - Rounds/Adjust Time to Timeclock/Timecard Stamp
'          for payroll hours worked
Dim MyLen As String     'used to determine length of time
Dim MyH As String       'used to set Hour
Dim MyM As String       'used to set Minutes
Dim MyS As String       'used to set Seconds
Dim MyAmPm As String    'used to set AM/PM
Dim strChr As String
  strChr = Chr(58)      'semi-colon character :
  MyLen = Len(varTime)
    If MyLen = 10 Then  '1 digit hr - Time resembles 6:36:02 AM
        MyH = Mid(varTime, 1, 1)
        MyM = Mid(varTime, 3, 2)
            If MyM <= 7 Then
                MyM = "00"
            End If
            If MyM > 7 And MyM < 16 Then
                MyM = "15"
            End If
            If MyM > 15 And MyM < 37 Then
                MyM = "30"
            End If
            If MyM > 37 And MyM < 49 Then
                MyM = "45"
            End If
            If MyM > 49 Then
                MyH = MyH + 1
                MyM = "00"
            End If
        MyS = "00"
        MyAmPm = Mid(varTime, 8, 3)
    Else    '2 digit hr - Time resembles 10:36:02 AM
        MyH = Mid(varTime, 1, 2)
        MyM = Mid(varTime, 4, 2)
            If MyM <= 7 Then
                MyM = "00"
                GoTo Update_Time
            End If
            If MyM > 7 And MyM < 16 Then
                MyM = "15"
                GoTo Update_Time
            End If
            If MyM > 15 And MyM < 37 Then
                MyM = "30"
                GoTo Update_Time
            End If
            If MyM > 37 And MyM <= 49 Then
                MyM = "45"
                GoTo Update_Time
            End If
            If MyM > 49 Then
                If MyH = 12 Then
                    MyH = MyH - 11
                    MyM = "00"
                    MyS = "00"
                    MyAmPm = Mid(varTime, 9, 3)
                        If MyAmPm = " AM" Then
                            MyAmPm = " PM"
                        Else
                            MyAmPm = " AM"
                        End If
                Else
                MyH = MyH + 1
                MyM = "00"
                MyS = "00"
                MyAmPm = Mid(varTime, 9, 3)
                    If MyAmPm = " AM" Then
                        MyAmPm = " PM"
                    Else
                        MyAmPm = " AM"
                    End If
                End If
            End If
    End If
    
fEditTime = MyH & strChr & MyM & strChr & MyS & MyAmPm

Exit Function

Update_Time:
    MyS = "00"
    MyAmPm = Mid(varTime, 9, 3)
    fEditTime = MyH & strChr & MyM & strChr & MyS & MyAmPm

End Function

Give me a reply back about the last 2 questions, and I'll give you a few ideas to implement this.

Not sure how much of the time field your keeping, but you can edit the above as needed.

Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
I'm not an overly proficient VBA user, but this is my take on the call timing method. It's not big, and it's not clever, but it is easy. My main application has a time sheet and call timing forms. The latter is designed to look like a timer, but is much more stupid than that!

Ignoring customer, date and description, it has the following locked fields: StartTime, StopTime, TotalTime, PauseTime. The form has buttons for Exit, Start, Stop and a toggle button for Pause. There are no record navigation buttons, no control box (min, max, close), it is set as 'Data Entry' (new records only) and Pop-up.

When the user opens the form, they are forced into a new record. They click start which disables Exit, sets StartTime to Now(), then disables the Start button. They can click pause as often as they like, but when they click Stop, it sets StopTime to Now(), all buttons are disabled and it essentially runs the following sum: TotalTime = (StopTime - StartTime) + (PauseTime). PauseTime has been calculated by temporary fields keeping a running total when the pause button has been switched. After the sum, it goes to a new record.

It's basic, but I've yet to see it broken or cheated. By setting the form as data entry pop-up with no standard buttons the user cannot get to any other form except by clicking Exit. This is disabled once they click Start, then the only way off the form is Stop. If they close the app with the cross, the forms OnClose event triggers the Stop button anyway. Times can't be changed because the fields are locked.

Additionally, I use a workgroup so the table has a user field populated by CurrentUser. For other forms not so easy to lockdown, I monitor updates and changes in a log table; clicking buttons, closing, editing forms, all cause a time-stamped description.
 
Dosn't necesserely fix the cheating options.... but your idea could work to start/stop new times... sending the startime() to the endtime() of last record through recordset, your thoughts???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top