Solved

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

Posted on 2004-08-30
4
208 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

813 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now