If e.DataCol.Name = "住院号" Then
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.NewValue & "'")
If dr IsNot Nothing Then
e.DataRow("患者姓名") = dr("患者姓名")
Else
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
End If
End If
执行后把姓名自动清空了
我的录入步骤:1、从列表项目分离出住院号,2、根据住院号找出匹配的姓名。如果没有匹配的姓名,则如下:
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
[此贴子已经被作者于2011-8-5 14:14:06编辑过]