|
Private Sub newrec_Click()
On Error GoTo Err_newrec_Click
Me.yearmonth = Mid(Me.yearmonth.DefaultValue, 2, 7)
Me.emid = Null
Me.emname = Null
Me.intime = Null
Me.fruit = Null
Me.rule = Null
Me.duty = Null
Me.active = Null
Me.linename = Null
Me.emid.SetFocus
Exit_newrec_Click:
Exit Sub
Err_newrec_Click:
MsgBox Err.Description
Resume Exit_newrec_Click
End Sub
Private Sub saverec_Click()
On Error GoTo Err_saverec_Click
Dim i As Integer
Dim STemp As String
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
STemp = "Select * From appraise"
Rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If IsNull(Me.yearmonth) = True Then
MsgBox "请输入“评价年月”,它不可以为空!", vbOKOnly, "输入“评价年月”"
Me.yearmonth.SetFocus
Exit Sub
ElseIf IsNull(Me.emid) = True Then
MsgBox "请输入“社员NO”,它不可以为空!", vbOKOnly, "输入“社员NO”"
Me.emid.SetFocus
Exit Sub
ElseIf IsNull(Me.emname) = True Then
MsgBox "请输入“社员NO”,它不可以为空!", vbOKOnly, "输入“社员NO”"
Me.emid.SetFocus
Exit Sub
ElseIf IsNull(Me.intime) = True Then
MsgBox "请输入“社员NO”,它不可以为空!", vbOKOnly, "输入“社员NO”"
Me.emid.SetFocus
Exit Sub
ElseIf IsNull(Me.fruit) = True Then
MsgBox "请输入“成果”,它不可以为空!", vbOKOnly, "输入“成果”"
Me.fruit.SetFocus
Exit Sub
ElseIf IsNull(Me.rule) = True Then
MsgBox "请输入“规律性”,它不可以为空!", vbOKOnly, "输入“规律性”"
Me.rule.SetFocus
Exit Sub
ElseIf IsNull(Me.duty) = True Then
MsgBox "请输入“责任性”,它不可以为空!", vbOKOnly, "输入“责任性”"
Me.duty.SetFocus
Exit Sub
ElseIf IsNull(Me.active) = True Then
MsgBox "请输入“积极性”,它不可以为空!", vbOKOnly, "输入“积极性”"
Me.active.SetFocus
Exit Sub
ElseIf IsNull(Me.linename) = True Then
MsgBox "请输入“社员NO”,它不可以为空!", vbOKOnly, "输入“社员NO”"
Me.emid.SetFocus
Exit Sub
Else
If Rs.RecordCount > 0 Then
Rs.MoveFirst
For i = 1 To Rs.RecordCount
If Rs("emid") = Me.emid And _
Rs("yearmonth") = Me.yearmonth Then
MsgBox "该编号的社员本月已评价,请核实!", vbCritical, "记录已经存在"
Exit Sub
Else
Rs.MoveNext
End If
Next i
End If
End If
DoCmd.SetWarnings False
STemp = "INSERT INTO appraise"
STemp = STemp & "(yearmonth,emid,emname,intime,"
STemp = STemp & "fruit,duty,rule,active,linename)"
STemp = STemp & "VALUES ('" & Me.yearmonth & "','" & Me.emid & "',"
STemp = STemp & "'" & Me.emname & "','" & Me.intime & "',"
STemp = STemp & "'" & Me.fruit & "','" & Me.duty & "',"
STemp = STemp & "'" & Me.rule & "','" & Me.active & "',"
STemp = STemp & "'" & Me.linename & "')"
DoCmd.RunSQL STemp
Me.appraise_sub.Requery
Set Rs = Nothing
Exit_saverec_Click:
Set Rs = Nothing
Exit Sub
Err_saverec_Click:
MsgBox Err.Description
Resume Exit_saverec_Click
End Sub
Private Sub modrec_Click()
On Error GoTo Err_modrec_Click
Dim i As Integer
Dim STemp As String
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
STemp = "Select * From appraise"
Rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If IsNull(Me.yearmonth) = True Then
MsgBox "请输入“ |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|