hulitk
asked on
No value given for one or more required parameters. - Record Set Selection Statement
Here is an Clip of the code that I am using:
cnt.Open("Provider=Microso ft.Jet.OLE DB.4.0;" & _
"Data Source=H:\Custom\edwards\I NV2002.mdb ")
rst.CursorType = ADODB.CursorTypeEnum.adOpe nStatic
InvStart = TextBox1.Text
InvFinish = TextBox2.Text
rst.open("SELECT InvoiceHeader.InvoiceNumbe r, InvoiceHeader.CustomerID, InvoiceHeader.SONumber, SOHeader.CustomerPO, InvoiceHeader.ShipmentDate ,ShipViaCo des.DescTe xt, 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.InvoiceNumb er >= InvStart) AND (InvoiceHeader.InvoiceNumb er <= InvFinish)ORDER BY InvoiceHeader.InvoiceNumbe r", cnt)
In Textbox1 I have: IN03 00003 and In Textbox2 I have: IN03 00006
If I put the exact values in
WHERE (InvoiceHeader.InvoiceNumb er >= 'IN03 00003') and (InvoiceHeader.InvoiceNumb er <= '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????
cnt.Open("Provider=Microso
"Data Source=H:\Custom\edwards\I
rst.CursorType = ADODB.CursorTypeEnum.adOpe
InvStart = TextBox1.Text
InvFinish = TextBox2.Text
rst.open("SELECT InvoiceHeader.InvoiceNumbe
In Textbox1 I have: IN03 00003 and In Textbox2 I have: IN03 00006
If I put the exact values in
WHERE (InvoiceHeader.InvoiceNumb
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????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When you use string types you have to use ', for dates #, for numbers just the number
ASKER
Your Awsome, I tried to figure this out for hours!! Thanx
You have to add an aphostrophe between the variables:
" ' "
with no spaces, i made this way for you to see the value.