ผมสร้างฟอร์ม Login ขึ้นมาหนึ่งฟอร์ม ผมต้องการสร้าง Table สำหรับเก็บ Log การ Login ว่า User Login เวลาไหน Logout เวลาไหน
เปิดฟอร์มไหนบ้าง และเปิดฟอร์มนั้นอัพเดทล่าสุดกี่โมง ต้องทำอย่างไรบ้างครับ
ปุ่ม Login มีโค้ดดังนี้ครับ
Private Sub cmdOK_Click()
Dim UserLevel As String
Dim WorkerName As String
Dim TempLoginID As String
Dim strDivision As String
Dim strLocation As String
If IsNull(Me.txt_Username) Then
    MsgBox "กรุณาใส่ชื่อผู้ใช้", vbInformation, "ชื่อผู้ใช้"
    Me.txt_Username.SetFocus
ElseIf IsNull(Me.txt_Password) Then
    MsgBox "กรุณาใส่รหัสผ่าน", vbInformation, "รหัสผ่าน"
    Me.txt_Password.SetFocus
Else
    If (IsNull(DLookup("UserLogin", "tblUser", "UserLogin ='" & Me.txt_Username.Value & "'"))) Or (IsNull(DLookup("Password", "tblUser", "Password ='" & Me.txt_Password.Value & "'"))) Then
        MsgBox "ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง"
    Else
            TempLoginID = Me.txt_Username.Value
            WorkerName = DLookup("UserName", "tblUser", "UserLogin ='" & Me.txt_Username.Value & "'")
            UserLevel = DLookup("UserSecurity", "tblUser", "UserLogin ='" & Me.txt_Username.Value & "'")
            
                If UserLevel = "Admin" Or UserLevel = "Mod" Then
                    DoCmd.OpenForm "frmSetup"
                    Forms![frmSetup]![txt_Login] = TempLoginID
                    Forms![frmSetup]![txt_User] = WorkerName
                    Forms![frmSetup]![txt_Division] = cb_Division.Column(1)
                    Forms![frmSetup]![txt_Location] = cb_Location.Column(1)
                    DoCmd.Close acForm, "frmLogin"
                Else
                    DoCmd.OpenForm "frmMainMenu"
                    Forms![frmMainMenu]![txt_Login] = TempLoginID
                    Forms![frmMainMenu]![txt_User] = WorkerName
                    Forms![frmMainMenu]![txt_Division] = cb_Division.Column(1)
                    Forms![frmMainMenu]![txt_Location] = cb_Location.Column(1)
                    DoCmd.Close acForm, "frmLogin"
                End If
    End If
End If
End Sub