Query help

S

SJL

Hi, I have a table that details requests and want to be able to pull up a
report by date range where the status is "Rejected" I have the date range
search as Between [ ] and [ ] and have put under status "Rejected". When I
run the query I am asked for date range, I do not get any Rejected requests
though.
 
J

John Spencer

Unless the Status field contains a date then searching against it for a date
range makes no sense at all. Similar to the following
Sir, what kind of fruit would you like? Response: Honda

It sounds to me like you need to search for Status = "Rejected" and
SomeDateField between [Period Starts] and [Period Ends]

Whoops! perhaps I misread your posting.

Try defining the parameters (and naming them).

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2

Optionally surround the parameters with CDate to make sure Access understands
that you are inputting dates
SomeDateField between CDate([Period Starts]) and CDate([Period Ends])

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
D

Douglas J. Steele

Another possibility is that Response is a lookup field, so that it doesn't
actually contain the text "Rejected", but instead contains the primary key
of the Status table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


John Spencer said:
Unless the Status field contains a date then searching against it for a
date range makes no sense at all. Similar to the following
Sir, what kind of fruit would you like? Response: Honda

It sounds to me like you need to search for Status = "Rejected" and
SomeDateField between [Period Starts] and [Period Ends]

Whoops! perhaps I misread your posting.

Try defining the parameters (and naming them).

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2

Optionally surround the parameters with CDate to make sure Access
understands that you are inputting dates
SomeDateField between CDate([Period Starts]) and CDate([Period Ends])

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Hi, I have a table that details requests and want to be able to pull up a
report by date range where the status is "Rejected" I have the date range
search as Between [ ] and [ ] and have put under status "Rejected". When
I run the query I am asked for date range, I do not get any Rejected
requests though.
 

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