I want to record emp in and out time. i have attached the form with this query. The structure of table is:
Code Text
Intime Date/Time
Otime Date/Time
Dated Date
-----------------------------------------------------
When i put code (e.g 1569) in code field it will track only intime nd when i put this code second time it will show only intime and cannot save the otime entry.
The 2nd problem is i only want it will shows this message:
You are about to append 1 row(s) ......Yess.......NO
-----------------------------------------------------------------
Here is the VBA Code:
Option Compare Database
Dim abc As String
Dim p As String
Dim aa As String
Dim strSQl As String
-----------------------------------------------------------------
Private Sub Code_AfterUpdate()
If Not (Intime) And (Dated) Then
If IsNull(Otime) And Otime = "" And Code = Code Then
Me.Otime = Now()
Me.T = DLookup("Name", "Student", "[GR No]=
Code Text
Intime Date/Time
Otime Date/Time
Dated Date
-----------------------------------------------------
When i put code (e.g 1569) in code field it will track only intime nd when i put this code second time it will show only intime and cannot save the otime entry.
The 2nd problem is i only want it will shows this message:
You are about to append 1 row(s) ......Yess.......NO
-----------------------------------------------------------------
Here is the VBA Code:
Option Compare Database
Dim abc As String
Dim p As String
Dim aa As String
Dim strSQl As String
-----------------------------------------------------------------
Private Sub Code_AfterUpdate()
If Not (Intime) And (Dated) Then
If IsNull(Otime) And Otime = "" And Code = Code Then
Me.Otime = Now()
Me.T = DLookup("Name", "Student", "[GR No]=
Code:
")
Me.aq = DLookup("Mobile", "Student", "[GR No]=[Code]")
strSQl = "Insert into MsgOut(iid,msg,send,msgto) Values ([code],'Today Classes Of Your Child is Ended...','Yes',aq);"
DoCmd.RunSQL (strSQl)
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
End If
'abc = [GR No]
abc = CStr(Code & ".jpg")
p = "D:\Photo\" & abc
img11.Picture = p
If IsNull(Otime) Then
tt = "IN"
End If
End Sub
+----------------------------------------------------------
Private Sub Code_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Me.T = DLookup("Name", "Student", "[GR No]=[Code]")
Me.aq = DLookup("Mobile", "Student", "[GR No]=[Code]")
strSQl = "Insert into MsgOut(iid,msg,send,msgto) Values ([code],'Your Child Has Arrived At School..','Yes',aq);"
DoCmd.RunSQL (strSQl)
' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
abc = CStr(Code & ".jpg")
p = "D:\Photo\" & abc
img11.Picture = p
If Not IsNull(Intime) And (Dated) Then
tt = "OUT"
End If
End Sub
----------------------------------------
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
Me.Intime = Now()
Me.Dated = Date
Me.Otime = ""
End Sub
---------------
pls help me in this regards