请哪位vb高手帮我看看?

来源:百度知道 编辑:UC知道 时间:2024/05/29 19:20:20
Private Sub find_data()
Dim str_find_hspaihao As String
str_find_hspaihao = InputBox("请输入焊丝牌号:", "查找")
Data1.Recordset.FindFirst "hs_paihao = ' " & str_find_hspaihao & " ' "
If Data1.Recordset.NoMatch = True Then
MsgBox "对不起,没有您要查找的记录!"
End If
End Sub

这一段程序有没哟问题啊?

'建议增加“空牌号”情况的识别

Private Sub find_data()
Dim str_find_hspaihao As String
str_find_hspaihao = InputBox("请输入焊丝牌号:", "查找")
If str_find_hspaihao = "" Then
MsgBox "【焊丝牌号】不可为空!"
Exit Sub
End If
Data1.Recordset.FindFirst "hs_paihao = ' " & str_find_hspaihao & " ' "
If Data1.Recordset.NoMatch = True Then
MsgBox "对不起,没有您要查找的记录!"
End If
End Sub

貌似没有!

有没问题。调试一下就知道了。

同意楼上,建议再加入对牌号的格式验证、非法字符验证。