help with query, please!!!

T

Test_1

I have an access database with a table called "Orders"
with a field "Date" (date/time type, using General date
format).
I need to create a report with the orders in a period of
time. To do so I capture the start and end dates of the
period using two text boxes in an form that posts to
an .asp page containing the database results created
using the FP wizard.
The custom query is as follows:

SELECT * FROM Orders WHERE (Orders.Date > ::StartDate::
AND Orders.Date < ::EndDate::)

Being StartDate y EndDate the names of the capturing Text
Boxes in the previous page.

When published and seen in browser the page does not
report any errors but does not filter the table, it means
I get all the records in the table.

What am I doing wrong? Please help!!
Thanks in advance.
 
M

MD WebsUnlimited.com

Hi,

The the between clause.

SELECT orders.*, orders.[Date Ordered]
FROM orders
WHERE (((orders.[Date Ordered]) Between #1/1/2003# And #1/31/2003#));
 
T

Test_1

Thank you a lot but it seems your message was somehow
truncated. Can you give me a more detailed explanation? I
tried the query you send me and it says there are too few
parameters.
thank you!.
 
M

MD WebsUnlimited.com

The message that I sent is correct but you'll need to modify the SQL to work
with the date field that you wish to utilize.
 
T

Test_1

Thanks again!

I used the following query with the "between" clause as
you suggested:

SELECT Orders.* FROM orders
WHERE (Orders.Date between #1/1/2003# and #1/31/2003#)

It works fine but now I need the two dates to be
parameters captured as character strings and not fixed
dates. Please help!

Thanks in advance!
 
M

MD WebsUnlimited.com

SELECT Orders.* FROM orders
WHERE (Orders.Date between #::startfielddate::# and #::endfielddate::#)


startfielddate and endfielddate are the names of the fields in the form for
the dates to be displayed.
 
T

Test_1

Thanks!

I did as you said and input this custom query:

SELECT orders.* FROM orders
WHERE (Orders.Date between #::StartDate::# and
#::EndDate::#);

But received this error while verifying the query:

[Microsoft][ODBC Microsoft Access Driver] Syntax error in
date in query expression '(Orders.Date between #1# and
#2#)'.

What can be wrong? Help please!!!

Thanks again!
 
M

MD WebsUnlimited.com

May I see the page on the net?

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
----------------------------------------------------------------------------
--------------------
If you think I'm doing a good job, let MS know at (e-mail address removed)

Test_1 said:
Thanks!

I did as you said and input this custom query:

SELECT orders.* FROM orders
WHERE (Orders.Date between #::StartDate::# and
#::EndDate::#);

But received this error while verifying the query:

[Microsoft][ODBC Microsoft Access Driver] Syntax error in
date in query expression '(Orders.Date between #1# and
#2#)'.

What can be wrong? Help please!!!

Thanks again!

-----Original Message-----
SELECT Orders.* FROM orders
WHERE (Orders.Date between #::startfielddate::# and #::endfielddate::#)


startfielddate and endfielddate are the names of the fields in the form for
the dates to be displayed.
--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
--------------------------------------------------------- -------------------
--------------------
If you think I'm doing a good job, let MS know at (e-mail address removed)





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top