Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Simple SQL Statement

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Simple SQL Statement
Prince 11.09.2006 16:32:02
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
RE: Simple SQL Statement
Klatuu 11.09.2006 17:18:01
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
on your form and reference that. It can be hidden if you don't want the user
to see it.

"Prince" wrote:

[Quoted Text]
> 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
Re: Simple SQL Statement
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com> 11.09.2006 19:56:43
"Prince" <Prince[ at ]discussions.microsoft.com> wrote in message
news:5D08ECFF-913B-4336-BCC0-5BF6C8A463FF[ at ]microsoft.com
[Quoted Text]
> 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)


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


RE: Simple SQL Statement
Prince 12.09.2006 11:52:01
Thanks for help.

"Prince" wrote:

[Quoted Text]
> 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

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net