|
代码如下,请问:例如[K]值曾为具体数值,如果不想为具体数值,他返回的结果怎么判断呢
实际情况就是:把[K]的数值设为空白,也就是说没有检查,那么[K-性质]也要相应改为空白...
Private Sub K_AfterUpdate()
Dim TempCountYcXm As Integer
Dim mySQL As String
If Not IsDate(Me.检查时间) Then
MsgBox "请输入检查时间"
Me.检查时间.SetFocus
Exit Sub
End If
TempCountYcXm = DCount("[异常结果]", "[异常结果]", "[编号]=" & Me.[编号] & " and [检查时间]=#" & Me.[检查时间] & "# and [异常项目]='K'")
mySQL = "INSERT into 异常结果(异常项目,异常结果,检查时间,编号,姓名,性别,检查时年龄)"
mySQL = mySQL & " values('K','" & Me.[K] & "',#" & Me.[检查时间] & "# ," & Me.[编号] & ",'" & Me.[姓名] & "','" & Me.[性别] & "'," & Me.[检查时年龄] & ")"
Select Case K
Case Is = Null "如果 数值 为 空白,则让 [K-性质]也是空白,注:[K]为单精度数字类型
[K-性质] = Null
Case Is > 5.5
[K-性质] = "升高"
If TempCountYcXm = 0 Then
CurrentDb.Execute mySQL
Else
CurrentDb.Execute "UPDATE 异常结果 SET 异常结果 = '" & Me.[K] & "' where [编号]=" & Me.[编号] & " and [检查时间]=#" & Me.[检查时间] & "# and [异常项目]='K'"
End If
Case Is >= 3.5
[K-性质] = "正常"
If TempCountYcXm > 0 Then CurrentDb.Execute "delete * from [异常结果] where [编号]=" & Me.[编号] & " and [检查时间]=#" & Me.[检查时间] & "# and [异常项目]='K'"
Case Else
[K-性质] = "降低"
If TempCountYcXm = 0 Then
CurrentDb.Execute mySQL
Else
CurrentDb.Execute "UPDATE 异常结果 SET 异常结果 = '" & Me.[K] & "' where [编号]=" & Me.[编号] & " and [检查时间]=#" & Me.[检查时间] & "# and [异常项目]='K'"
End If
End Select
End Sub |
|