INSERT INTO fails w "Missing Parameter"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone clarify for me why this crashes:

Dim strSQL As String
strSQL = "INSERT INTO MtchStaffTbl (MchStfFNo, MchStfIDCode) " & _
"VALUES (Me.EnFNo, Me.StaffAddLstBx);"
CurrentDb.Execute strSQL, dbFailOnError

The message is "Too few Parameters. Expected 2."

Thanks in advance.
 
This looks suspicious:
Me.StaffAddLstBx)

Is AddLstBx a List Box control on you form? If not, what is it?
 
Yes. Me.StaffAddLstBx is a list box, and the bound column contains the
correct text data...
 
Sorry, I am not seeing the problem. Since I have never used a List Box like
this, I don't know if that is a problem or not. I think it should not be,
but I would have use a Combo. As a test, try pluggin a value in by hand and
running it to see what happens:

"VALUES (Me.EnFNo, 99);"
 
Back
Top