too few parameters

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

Guest

hi all

Hope someone out there can hel

Set rst1 = dbs.OpenRecordset("SELECT tblControlNoParts.ControlNo, tblControlNoParts.LineNo, tblControlNoParts.PartNo " & _ "FROM tblControlNoParts WHERE (((tblControlNoParts.ControlNo)=[Forms]![frmControlNoParts]![ControlNo]))"

is giving me a Too Few Paramaters error Expected 1

If I take the where clause out I'm fine. I'm not sure what parameter it's looking for. I think it's looking for dbOpenTable or something at the end, but that one doesn't work - what is another to try

Thanks in advanc
Joan
 
Joan,

Access is looking for the meaning of [Forms]![frmControlNoParts]![ControlNo]

Do it like this instead...
Set rst1 = dbs.OpenRecordset("SELECT tblControlNoParts.ControlNo,
tblControlNoParts.LineNo, tblControlNoParts.PartNo " & _
"FROM tblControlNoParts " & _
"WHERE tblControlNoParts.ControlNo =" &
[Forms]![frmControlNoParts]![ControlNo]
.... or, if this code is on an event on the frmControlNoParts form...
"WHERE tblControlNoParts.ControlNo) =" & Me.ControlNo
This is if ControlNo is a number data type. If it's text, do this...
"WHERE tblControlNoParts.ControlNo) ='" &
[Forms]![frmControlNoParts]![ControlNo] & "'"
 
Back
Top