Solved

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

20 Experts available now in Live!

Get 1:1 Help Now