Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date query doesnt work

Status
Not open for further replies.

bevan

Programmer
Jan 11, 2001
22
GB
Hi,
I'm trying to write a pretty basic report with asp. The inputs are the ledger code (account code) and the start and finish dates of the report. For some reason it doesn't like my query.
I used response.write to show it on screen.
Next I tried copying the query into Access and it worked fine!

Any ideas?
I've included my screen dump and the useful code....



**** screen output *****
SELECT * FROM qryREPORT2 WHERE time_stamp BETWEEN #01/01/01# AND #06/21/01# AND gl = '101/000' ORDER BY time_stamp;
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.

/po2001/content/reports/report.asp, line 46



**** CODE *****
(the LAST line is line 46, ie the recordset opening)

<%
'declare variables
dim strSQL , strLedger , strStart , strFinish

'grab values passed from previous page which indicate the time period of the report and the relevent ledger
strLedger = request.querystring(&quot;Ledger&quot;)
strStart = request.querystring(&quot;SD&quot;)
strFinish = request.querystring(&quot;FD&quot;)

strSQL = &quot;SELECT * FROM qryREPORT2 WHERE time_stamp BETWEEN #&quot; & strStart & &quot;# AND #&quot; & strFinish & &quot;# AND gl = '&quot; & strLedger & &quot;' ORDER BY time_stamp;&quot;
response.write strSQL

objRS.Open strSQL, objConn
%>
 
What is time_stamp. I'm not familiar with that piece of this code.

-d
 
Time_stamp is the date and time that the record was entered into the database.
It is set as a date/time field in Access.
Basically all the query does is look for all the orders that were entered into the system in a certain time frame.

B
 
Try taking off that semi-colon -- The query looks ok other than that -- and since it compiles in Access, I don't know what else it would be.

hope that helps! :)
Paul Prewett
penny.gif
penny.gif
 
Just to let you all know.....

I have got this query to work now. I changed the query in access. Before it was quite a complex join so I made an intermediary query first and then joined two of them.

Basically the problem was in the access query - NOT in the asp code.


B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top