0

我在一个表单上有一个搜索框,可以在结帐和订购表单上按 OrderID(例如 305321)查找记录,第二个是我刚刚添加到表单中以查找搜索 FLID 值(例如 FLID00005)的地板产品的第二个但是即使我正在搜索的数据存在并且当我在其上使用输入功能时,它也只会返回一条新记录,它会要求一个参数值,如果我在搜索框中输入相同的值,它会正常运行。

订单搜索表单的代码:

    Private Sub cmdFindbyOID_Click()
    If IsNull([FindByOIDSearchBox]) Then
        MsgBox "You must Enter a Order ID", vbInformation, "Error"
        Exit Sub
    End If
    Me.Filter = "(([Orders In Progress Query].OrderID = " & FindByOIDSearchBox & "))"
    Me.FilterOn = True
    Me.[Orders All Details Subform].Requery
End Sub

Private Sub FindByOIDSearchBox_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        cmdFindByOID.SetFocus
    If IsNull([FindByOIDSearchBox]) Then
        MsgBox "You must Enter a Order ID", vbInformation, "Error"
        Exit Sub
    End If
    Me.Filter = "(([Orders In Progress Query].OrderID = " & FindByOIDSearchBox & "))"
    Me.FilterOn = True
    Me.[Orders All Details Subform].Requery
    End If
End Sub

地板产品代码形式:

Private Sub cmdFindbyFLID_Click()
    If IsNull([findByFLIDSearchBox]) Then
        MsgBox "You must Enter a Flooring ID", vbInformation, "Error"
        Exit Sub
    End If
    Me.Filter = "(([Flooring Products Query].FLID = " & findByFLIDSearchBox & "))"
    Me.FilterOn = True
End Sub

Private Sub FindByFLIDSearchBox_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        cmdFindbyFLID.SetFocus
    If IsNull([findByFLIDSearchBox]) Then
        MsgBox "You must Enter a Flooring ID", vbInformation, "Error"
        Exit Sub
    End If
    Me.Filter = "(([Flooring Products Query].FLID = " & findByFLIDSearchBox & "))"
    Me.FilterOn = True
    End If
End Sub
4

1 回答 1

0

FLID 包含字符。因此,您的参考需要在单引号内。

Me.Filter = "(([Flooring Products Query].FLID = '" & findByFLIDSearchBox & "'))"
于 2013-08-22T13:10:44.780 回答