0

我正在尝试从 openrecordset 填充多个文本框并收到以下错误

运行时错误 3601 参数太少。预计 1

这是我的功能

Function fnSearchAndPopulate() As Boolean
Dim d As DAO.Database, r As DAO.Recordset, strSQL As String
Set d = CurrentDb
If Me.txtEnterNumber = "" Then
    MsgBox "Please Enter Number", , "Error"
    Exit Function
End If
strSQL = "SELECT * FROM amipartnumbers Inner Join jdsubs on amipartnumbers.oemitem=jdsubs.oempartnumber WHERE " & txtEnterNumber.Value & " In (jdsubs.oempartnumber, jdsubs.oemsubnumber)"
Set r = d.OpenRecordset(strSQL)
If r.EOF Then
   MsgBox "BAM # " & Me.txtEnterNumber & " does not exist!", , "No BAM #"
  Set d = Nothing
  Exit Function
End If
'get here if there is a record
r.MoveFirst
'populate whatever textboxes
Me.txtAMINumber = r!Item
Me.txtDescription = r!Description
Me.txtOEMsubnumber = r!OEMsubnumber

Set d = Nothing
Exit Function
End Function
4

1 回答 1

0

更新了非数字零件号...

strSQL = " SELECT * FROM amipartnumbers Inner Join jdsubs on "     & _
         " amipartnumbers.oemitem=jdsubs.oempartnumber WHERE "     & _
         " jdsubs.oempartnumber= '" & txtEnterNumber.Value & "' or "  & _
         " jdsubs.oemsubnumber= '"  & txtEnterNumber.Value & "'"
于 2013-05-08T19:55:18.773 回答