[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2004-08-30
4
Medium Priority
?
222 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 2000 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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

872 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