版主啊:随着技术的升级,希望的要求也随着升级,问题也就随着升级了啊,真是越来越复杂了啊...哈哈作者: SunmoonBaby 时间: 2007-11-26 15:52 标题: 是这样的麽? Private Sub K_AfterUpdate()
' 判断"检查时间"是否录入
If Not IsDate(Me.检查时间) Then
MsgBox "请输入检查时间"
Me.检查时间.SetFocus
Exit Sub
End If
' 判断 [K]植在正常范围内时
If [K] >= 3.5 & [K] <= 5.5 Then
[K-性质] = "正常"
' 判断条件:[编号][检查时间][异常项目]同时相同的记录就是需要处理的记录
If DCount("[异常项目]", "[异常结果]", "[编号],[检查时间]") > 0 Then Recordset.Delete ' 存在记录就删除(说明以前录入的错了)
Exit Sub
End If
If [K] > 5.5 Then
[K-性质] = "升高"
If DCount("[异常项目]", "[异常结果]", "[编号],[检查时间]") > 0 Then [异常结果]![异常结果] = Me.[K] ' 存在记录便更新
Else
Dim mySQL As String
mySQL = "INSERT into 异常结果(异常项目,异常结果,检查时间,编号,姓名,性别,检查时年龄)"
mySQL = mySQL & " values('K','" & Me.[K] & "',#" & Me.[检查时间] & "# ," & Me.[编号] & ",'" & Me.[姓名] & "','" & Me.[性别] & "','" & Me.[检查时年龄] & "')"
CurrentDb.Execute mySQL
Exit Sub
End If
End If
If [K] < 3.5 Then
[K-性质] = "降低"
If DCount("[异常项目]", "[异常结果]", "[编号],[检查时间]") > 0 Then [异常结果]![异常结果] = Me.[K]
Else
Dim mySQL As String
mySQL = "INSERT into 异常结果(异常项目,异常结果,检查时间,编号,姓名,性别,检查时年龄)"
mySQL = mySQL & " values('K','" & Me.[K] & "',#" & Me.[检查时间] & "# ," & Me.[编号] & ",'" & Me.[姓名] & "','" & Me.[性别] & "','" & Me.[检查时年龄] & "')"
CurrentDb.Execute mySQL
Exit Sub
End If
End If