我有一个数据输入表单,我想要一个特定的文本框来执行表的搜索,以查找在文本框中输入的数据是否已经存在于表的相关字段中。这是我目前的代码,它返回rst.FindFirst "[SuperPNR] = & SuperPNR"
上数据类型错误的不匹配
这让我很困惑......
Private Sub SuperPNR_AfterUpdate()
If (SuperPNR & vbNullString) = vbNullString Then Exit Sub
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Travel Fraud Data - Test")
rst.FindFirst "[SuperPNR] = & SuperPNR"
If rst.NoMatch Then
Else
MsgBox "Record Already In Database!", vbOKOnly + vbInformation, "Do Not Save Record!"
End If
rst.Close
Set rst = Nothing
Set dbs = Nothing
End Sub