Re: Error "no value given for one or more required parameters"
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 15 Oct 2005 00:06:27 +0200
On Thu, 13 Oct 2005 21:59:48 -0700, JohnC wrote:
>I just could not figure out what is wrong or missing - here my sample code:
>
> Dim horse_recordset As New ADODB.Recordset
> Dim SQLstmt As String
> Dim xyz As Integer
>
> xyz = 13
>
> SQLstmt = "SELECT [Horse-ID], [Horse Name], [Registration Nummer],
>[Breed] FROM Horses WHERE (Horses.[Horse-ID] = xyz);"
>
> horse_recordset.Open SQLstmt, CurrentProject.Connection,
>adOpenForwardOnly, adLockReadOnly
>
>Regardless of what I have tried I always get the same error - if I enter a
>specific value in the query for ex. I "hard-code" 13 into the query instead
>of xyz the query runs with no error - therefore it must have something to do
>the way I use or declare the variable xyz or the syntax.
>
>PLEASE HELP!!!!
Hi John,
Try this one instead:
SQLstmt = "SELECT [Horse-ID], [Horse Name], [Registration Nummer],
[Breed] FROM Horses WHERE (Horses.[Horse-ID] = " & xyz & ");"
By the way, you posted this to the .mseq group, which is actually
intended for support of Microsoft English Query. Your code looks like VB
calling SQL Server. You might get more and better replies in either one
of the VB groups, or in microsoft.public.sqlserver.programming.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
.
- Prev by Date: Re: Simple ranking within group
- Next by Date: Re: Help with query formatting
- Previous by thread: Re: Simple ranking within group
- Next by thread: Re: Help with query formatting
- Index(es):
Relevant Pages
|
|