hi ppl!
here i'm getting an runtime error (Too Few Parameters, expected 1) while executing a query with vb which is running perfectly while executing from msaccess. pls pls help me in solving this. its littlebit urgent.
here the queries;
executed in msaccess,
SELECT ITEM_MASTER.ITEM_NO, ITEM_MASTER.INTERNAL_DESC, ITEM_MASTER.UOM_CODE, ITEM_MASTER.FLAG_NO, ITEM_REFERENCE.ORGAN_REF_CODE, ITEM_REFERENCE.ORGAN_CAT, ITEM_MASTER.LONG_DESC, ITEM_MASTER.UPD_ON, ITEM_MASTER.INSERTED_ON, ITEM_MASTER.EXPORT_FLAG, ITEM_MASTER.ITEM_ID, ITEM_REFERENCE.ORGAN_CODE
FROM ITEM_REFERENCE RIGHT JOIN ITEM_MASTER ON ITEM_REFERENCE.ITEM_ID = ITEM_MASTER.ITEM_ID
WHERE (((ITEM_MASTER.INSERTED_ON) Between #3/30/2007# And #4/4/2007#))
ORDER BY ITEM_MASTER.ITEM_NO;
exceuted in vb, throwing error,
SELECT ITEM_MASTER.ITEM_NO, ITEM_MASTER.INTERNAL_DESC, ITEM_MASTER.UOM_CODE, ITEM_MASTER.FLAG_NO, ITEM_REFERENCE.ORGAN_REF_CODE, ITEM_REFERENCE.ORGAN_CAT, ITEM_MASTER.LONG_DESC, ITEM_MASTER.UPD_ON, ITEM_MASTER.INSERTED_ON, ITEM_MASTER.EXPORT_FLAG,ITEM_MASTER.ITEM_ID,ITEM_R EFERENCE.ORGAN_CODE FROM ITEM_REFERENCE RIGHT JOIN ITEM_MASTER ON ITEM_REFERENCE.ITEM_ID = ITEM_MASTER.ITEM_ID WHERE (((ITEM_MASTER.INSERTED_ON) Between " & txt_from.Text & " And " & txt_to.Text & "))ORDER BY ITEM_MASTER.ITEM_NO")
by
prakash
3 1906
Depending on the version of VB and how you are using this SQL, the problem might be that you are including your control names rather than their values within the SQL string, and the SQL interpreter doesn't know what to do with them.
Can you show us the actual piece of code which builds/uses this SQL string?
And what version of VB are you using?
Oh, one other thing. If INSERTED_ON is a date field, you should be putting # delimiters around the values you're comparing it to.
version - vb 6.0
dtp1 and 2 are datepicker control names
tmp = "#" & DTP1.Value & "#"
tmp1 = "#" & DTP2.Value & "#"
txt_from.Text = tmp
txt_to.Text = tmp1
Set rdostr = cn.Execute("SELECT ITEM_MASTER.ITEM_NO, ITEM_MASTER.INTERNAL_DESC, ITEM_MASTER.UOM_CODE, ITEM_MASTER.FLAG_NO, ITEM_REFERENCE.ORGAN_REF_CODE, ITEM_REFERENCE.ORGAN_CAT, ITEM_MASTER.LONG_DESC, ITEM_MASTER.UPD_ON, ITEM_MASTER.INSERTED_ON, ITEM_MASTER.EXPORT_FLAG,ITEM_MASTER.ITEM_ID,ITEM_R EFERENCE.ORGAN_CODE FROM ITEM_REFERENCE RIGHT JOIN ITEM_MASTER ON ITEM_REFERENCE.ITEM_ID = ITEM_MASTER.ITEM_ID WHERE (((ITEM_MASTER.INSERTED_ON) Between " & txt_from.Text & " And " & txt_to.Text & "))ORDER BY ITEM_MASTER.ITEM_NO")
Did this work?
(You might need to explicitly format the date values as mm/dd/yyyy, since this is the format that SQL requires.)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: colm |
last post by:
i get the above runtime error on the following line of code
when i try to update a reord in my form
when it gets to the line
Set rs = DBEngine(0)(0).OpenRecordset(strSql)
the entire code...
|
by: Leon Shaw |
last post by:
Need help understanding?
Server Error in '/solo' Application.
----------------------------------------------------------------------------
----
Object must implement IConvertible....
|
by: Arif Khan |
last post by:
Hi, I want to write down a function entry point logging method, allowing
logging of passed in parameters values along with function name and parameter
names. I know I can get the parameter name and...
|
by: Andrew |
last post by:
Hi,
I have a scenario in which both the source and format string for a
sscanf() call is selected *at runtime*. The number of format
conversions/substitutions is known as well as the maximum...
|
by: Richard Hollenbeck |
last post by:
I thought I was very specific in this SQL request. There is a form open
with a selected record (and a corresponding "lngRecipeID" on that form. The
table also has a field called "lngRecipeID". ...
|
by: John Friedland |
last post by:
My problem: I need to call (from C code) an arbitrary C library
function, but I don't know until runtime what the function name is,
how many parameters are required, and what the parameters are. I...
|
by: katrinkerber |
last post by:
Hello,
I need help to solve a runtime error that keeps reocurring every time I try to convert an Excel file into an Acess File. I have looked through many forums trying to find help, but I have...
|
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= |
last post by:
Hi,
I am passing a couple of objects through a web service and get the error
message below when I check the event log:
System.Runtime.Serialization.SerializationException: The type...
|
by: phill86 |
last post by:
Hi,
I am trying to run the following query in a recordset and i get the following error message
Runtime error 3061 - Too few parameters. Expected 1
i am using the following code
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| | |