Simple SQL Statement

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

Guest

Hi,
I am using simple SQL statement :

Set Rs = Db.OpenRecordset("SELECT DetailPicknote.DTime,
DetailPicknote.DDate, DetailPicknote.DetailID FROM DetailPicknote WHERE
DetailPicknote.DetailID = x")

where x = double

Error: Too few parameters : Expected 1
 
You can't use a variable in an SQL statement (and x is a horrible thing to
name a varialbe. What is it and what data type is it. Do yourself a favor
and start using good naming conventions). You will have to create a control
 
Prince said:
Hi,
I am using simple SQL statement :

Set Rs = Db.OpenRecordset("SELECT DetailPicknote.DTime,
DetailPicknote.DDate, DetailPicknote.DetailID FROM DetailPicknote
WHERE DetailPicknote.DetailID = x")

where x = double

Error: Too few parameters : Expected 1

If x is a variable in your code procedure, the OpenRecordset method
isn't going to know about it, and will interpret the name "x" as a
parameter, for which you haven't supplied a value. If this is the
problem, try this:

Set Rs = Db.OpenRecordset( _
"SELECT DTime, DDate, DetailID " & _
"FROM DetailPicknote " & _
"WHERE DetailPicknote.DetailID = " & x)
 
Back
Top