试试
Dim st As Date = Date.Now '将开始时间保存在变量st中
Dim txt As String = e.Form.Controls("TextBox1").text
txt = "'%" & txt & "%'"
Dim drs As List(Of DataRow) = DataTables("商品信息表").Select("商品名称 Like " & txt & " Or 商品编号 Like " & txt & " Or 拼音码 Like " & txt)
If drs.count = 1 Then
Tables("零售总表").Current("永久编号") = drs(0)("永久编号")
Tables("零售总表.零售明细表").AddNew
Tables("零售总表.零售明细表").Current("商品编号") = drs(0)("永久编号")
e.Form.Controls("TextBox1").text = ""
e.Form.Controls("TextBox1").Select
ElseIf drs.count = 0 Then
MessageBox.Show("不存在此商品,请重新输入")
e.Form.Controls("TextBox1").text = ""
ElseIf drs.count > 1 Then
forms("查询").open()
forms("查询").Controls("TextBox1").text = e.Form.Controls("TextBox1").text
End If
MessageBox.Show("耗时: " & (Date.Now - st).TotalSeconds & "秒") '计算并显示执行代码所花费的秒数
或者加上 stopredraw或systemready
http://www.foxtable.com/webhelp/scr/0453.htm
http://www.foxtable.com/webhelp/scr/2218.htm