Ultra King
New member
- Local time
- Today, 22:10
- Joined
- Dec 19, 2013
- Messages
- 4
HELLO ALL...
I have table name tbl_TimeRecord. It has 3 fields that name EmpID, Sign_Time, and Mark. I use a form name FormUser to add new record into tbl_TimeRecord..
In this form it has 3 text box by name txtEmpID, txtSign_Time, and txtMark. User only need to key in their ID in txtEmpID and the other will store automatically using vba code. But the result is not like what I expect it should be, because there is no value of Mark at all in tbl_TimeRecord. Can anyone help me in this matter, below is an example of my vba code
I have table name tbl_TimeRecord. It has 3 fields that name EmpID, Sign_Time, and Mark. I use a form name FormUser to add new record into tbl_TimeRecord..
In this form it has 3 text box by name txtEmpID, txtSign_Time, and txtMark. User only need to key in their ID in txtEmpID and the other will store automatically using vba code. But the result is not like what I expect it should be, because there is no value of Mark at all in tbl_TimeRecord. Can anyone help me in this matter, below is an example of my vba code
Code:
Private Sub txtEmpID_AfterUpdate()
Me.txtSign_Time = Now()
Dim tdyDate As Date
Dim k As Integer
Dim m As Integer
m = 1
k = 1
Do While tdyDate = Now()
If Me.txtEmpID = DLookup("EmpID", "tbl_TimeRecord") Then
Me.txtMark = Int(m)
Else
Me.txtMark = Int(k)
End If
m = m + 1
Loop
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , "", acNewRec
End Sub
