Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

610 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