Solved

No value given for one or more required parameters. - Record Set Selection Statement

Posted on 2004-08-30
4
214 Views
Last Modified: 2010-04-23
Here is an Clip of the code that I am using:

cnt.Open("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                                                       "Data Source=H:\Custom\edwards\INV2002.mdb")

        rst.CursorType = ADODB.CursorTypeEnum.adOpenStatic

        InvStart = TextBox1.Text
        InvFinish = TextBox2.Text

        rst.open("SELECT InvoiceHeader.InvoiceNumber, InvoiceHeader.CustomerID, InvoiceHeader.SONumber, SOHeader.CustomerPO, InvoiceHeader.ShipmentDate,ShipViaCodes.DescText, FOBCodes.DescText AS Expr1 FROM(((InvoiceHeader INNER JOIN SOHeader ON InvoiceHeader.SONumber = SOHeader.SONumber) INNER JOIN ShipViaCodes ON SOHeader.ShipViaCode = ShipViaCodes.ShipViaCode) INNER JOIN FOBCodes ON SOHeader.FOBCode = FOBCodes.FOBCode) WHERE (InvoiceHeader.InvoiceNumber >= InvStart) AND (InvoiceHeader.InvoiceNumber <= InvFinish)ORDER BY InvoiceHeader.InvoiceNumber", cnt)

In Textbox1 I have: IN03 00003 and In Textbox2 I have: IN03 00006

If I put the exact values in
WHERE (InvoiceHeader.InvoiceNumber >=  'IN03 00003') and (InvoiceHeader.InvoiceNumber <=  'IN03 00006')
It Works

But If I want it to pull the values from my text boxes it says
No value given for one or more required parameters.

If pull up a watch window and I put a watch on InvStart and InvFinish they contain the proper values.

Any Ideas????
0
Comment
Question by:hulitk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 8

Expert Comment

by:wguerram
ID: 11936528
WHERE (InvoiceHeader.InvoiceNumber >= & "'" & InvStart & "'" &) AND (InvoiceHeader.InvoiceNumber <= & "'" & InvFinish & "'")

You have to add an aphostrophe between the variables:

" ' "

with no spaces, i made this way for you to see the value.
0
 
LVL 8

Accepted Solution

by:
wguerram earned 500 total points
ID: 11936546
This is the correct way:

 rst.open("SELECT InvoiceHeader.InvoiceNumber, InvoiceHeader.CustomerID, InvoiceHeader.SONumber, SOHeader.CustomerPO, InvoiceHeader.ShipmentDate,ShipViaCodes.DescText, FOBCodes.DescText AS Expr1 FROM(((InvoiceHeader INNER JOIN SOHeader ON InvoiceHeader.SONumber = SOHeader.SONumber) INNER JOIN ShipViaCodes ON SOHeader.ShipViaCode = ShipViaCodes.ShipViaCode) INNER JOIN FOBCodes ON SOHeader.FOBCode = FOBCodes.FOBCode) WHERE (InvoiceHeader.InvoiceNumber >= '" & InvStart & "') AND (InvoiceHeader.InvoiceNumber <= '" & InvFinish & "') ORDER BY InvoiceHeader.InvoiceNumber", cnt)




0
 
LVL 8

Expert Comment

by:wguerram
ID: 11936566
When you use string types you have to use ', for dates #, for numbers just the number
0
 
LVL 2

Author Comment

by:hulitk
ID: 11936571
Your Awsome, I tried to figure this out for hours!! Thanx
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question