Time In And Time Out Using Userform

  • Good day!
    I think this i an easy task but unfortunately i wasn't able to find answer on google.
    I am doing a TIME-IN and TIME Out using userform.
    I have PC_Laborer sheet and Attendance sheet and USERFORM (Employee Code textbox, Employee Name textbox).
    When Employee Code is entered on txtCODE, Employee name Appeared on txtEmp (using vlookup).
    Log-in details will be inputted on Attendance Sheet when Time-in button Click .
    Attendance sheet have 4 columns (Name,Time-in,Time-Out,Date)
    I successfully do the Time-IN (using times stamp vba code on attendance sheet) and check for duplicate entry when "time-in button" Click.
    My problem is how to put the time out details of the employee and also Check if the employee is already time-out upon clicking the Time-out button.
    Thanks in advance.
    Below is my workbook
    ozgrid.com/forum/core/index.php?attachment/57723/

  • Re: Time In And Time Out Using Userform


    Thanks for the info.
    But i think this is too advance for what I need.
    I don't need a password for punch in. Additionally, it keeps my PC hang when i use it.

  • Re: Time In And Time Out Using Userform


    Hi..


    I removed the entire Sheet_Change Event code.. it wasn't needed..


    You had a few other strange things going on there.. like you had:

    Code
    1. Application.ScreenUpdating = False


    At the top and bottom of your code in a few places.. that wasn't helping much..


    The attached should do what you wanted.. I made it so the row gets colored grey when someone times out too.. :)

  • Re: Time In And Time Out Using Userform


    hello Apo,
    I have a simple problem, i've noticed that Employee name (txtEmp) is not matched with that of employee number (txtCode)
    when I tried to change the Employee Code to
    [TABLE="width: 384"]

    [tr]


    [td]

    Employee Code

    [/td]


    [td]

    Full Name

    [/td]


    [/tr]


    [tr]


    [td]

    IN100

    [/td]


    [td]

    Employee A

    [/td]


    [/tr]


    [tr]


    [td]

    IN101

    [/td]


    [td]

    Employee B

    [/td]


    [/tr]


    [tr]


    [td]

    IN102

    [/td]


    [td]

    Employee C

    [/td]


    [/tr]


    [tr]


    [td]

    IN103

    [/td]


    [td]

    Employee D

    [/td]


    [/tr]


    [tr]


    [td]

    IN104

    [/td]


    [td]

    Employee E

    [/td]


    [/tr]


    [tr]


    [td]

    IN105

    [/td]


    [td]

    Employee F

    [/td]


    [/tr]


    [tr]


    [td]

    IN106

    [/td]


    [td]

    Employee G

    [/td]


    [/tr]


    [tr]


    [td]

    IN107

    [/td]


    [td]

    Employee H

    [/td]


    [/tr]


    [tr]


    [td]

    IN108

    [/td]


    [td]

    Employee I

    [/td]


    [/tr]


    [tr]


    [td]

    IN109

    [/td]


    [td]

    Employee J

    [/td]


    [/tr]


    [tr]


    [td]

    IN110

    [/td]


    [td]

    Employee K

    [/td]


    [/tr]


    [tr]


    [td]

    IN111

    [/td]


    [td]

    Employee K

    [/td]


    [/tr]


    [/TABLE]


    Into this
    [TABLE="width: 384"]

    [tr]


    [td]

    Employee Code

    [/td]


    [td]

    Full Name

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620129

    [/td]


    [td]

    Employee A

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620138

    [/td]


    [td]

    Employee B

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620141

    [/td]


    [td]

    Employee C

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620177

    [/td]


    [td]

    Employee D

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620157

    [/td]


    [td]

    Employee E

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620180

    [/td]


    [td]

    Employee F

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620162

    [/td]


    [td]

    Employee G

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620115

    [/td]


    [td]

    Employee H

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620218

    [/td]


    [td]

    Employee I

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620163

    [/td]


    [td]

    Employee J

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620150

    [/td]


    [td]

    Employee K

    [/td]


    [/tr]


    [tr]


    [td]

    9710314620175

    [/td]


    [td]

    Employee K

    [/td]


    [/tr]


    [/TABLE]

  • Re: Time In And Time Out Using Userform


    Change the Initialize Code to


    In the login buttons yoy declare and set the Variable ws, but don't use it completely


    Code
    1. With Sheets("Attendance")
    2. 'should be
    3. With ws
  • Re: Time In And Time Out Using Userform


    I've edited the code slightly


  • Re: Time In And Time Out Using Userform


    One Last question,
    If the employee will punch-in the next day. The data entry should be accepted.
    I am trying to use look up for the value on the text box and his last log-out
    If the time-out date is less than the current date the data will be accepted.
    And if the employee did not punch-out
    "mëssage box" will appear.
    BUT i am lost.......

  • Re: Time In And Time Out Using Userform


    To Apo and royUK,
    No i dont need a reset mechanism.
    Because i tried to time in and time out and reset the date of my system to the next day to check if i can punch-in.
    But it says "You already Timed-in" and to think it is not the same day.
    Hopefully you can help me on this.
    Thanks..

  • Re: Time In And Time Out Using Userform



    Hello,


    Please help, i want to change Employee Code Box(combobox) to textbox. can you share to me the code. tnx in advance...

  • Re: Time In And Time Out Using Userform


    Why change to a TextBox and so increase the risk of user error? If you want to change it then delete the combobox , add a TextBox and amend the code. It's not difficult

  • Re: Time In And Time Out Using Userform


    Hi Apo,


    I'm trying to use and copy the codes in the timesheet sample in this thread with the file im working on right now. but the code is not working and gives me an error: Compile error: Variable not defined.


    Private Sub ComboBox1_Change()
    On Error GoTo Handler:
    txtEmp.Value = Application.WorksheetFunction.VLookup(ComboBox1.Text, Sheets("PC_Laborer").Range("A1:E13"), 2, 1)
    empLabel.Caption = Application.WorksheetFunction.VLookup(ComboBox1.Text, Sheets("PC_Laborer").Range("A1:E13"), 4, 1)
    Image1.Picture = Application.WorksheetFunction.VLookup(ComboBox1.Text, Sheets("PC_Laborer").Range("A1:E13"), 5, 1) 'Display Photo
    Handler:
    End Sub


    can you help me with this one please?

  • Re: Time In And Time Out Using Userform


    Hi oijoii, welcome to Ozgrid.


    Please can you start a new thread for your question - we have a rule in this forum that we don't ask questions in other people's threads. To provide clarity, you can post a link in your question back to this thread and explain that this is where your question originates from.


    Please also note the rule about code tags - whenever you post code please use tags like so: [NOPARSE]

    Code
    1. some code here

    [/NOPARSE] or you can highlight your code and press the [#] button in the text editor toolbar.


    If you have any questions on this, please feel free to send me a PM.


    Regards,


    S O