Need to create a query

  • Thread starter Thread starter rblivewire
  • Start date Start date
R

rblivewire

Is there anyway I can create a query that finds all records before a
specific date. I have tried

< Month([Date Sent To DTP Service])=[Choose Month] And Day([Date Sent
To DTP Service])="1" And Year([Date Sent To DTP Service])=[Choose
Year])

I want it to find all the results from before the first of a user input
date. Everything seems to work except the "<" sign in the beginning. If
I put less than, it gives me no results and if I put >, it gives me all
results. Any suggestions?
 
Is there anyway I can create a query that finds all records before a
specific date. I have tried

< Month([Date Sent To DTP Service])=[Choose Month] And Day([Date Sent
To DTP Service])="1" And Year([Date Sent To DTP Service])=[Choose
Year])

I want it to find all the results from before the first of a user input
date. Everything seems to work except the "<" sign in the beginning. If
I put less than, it gives me no results and if I put >, it gives me all
results. Any suggestions?

Hi rblivewire,
if I understand your question you want:
If the user enter 02/20/2006 all the records where [Date Sent To DTP
Service] is less than 01/02/2006
If so your Where statemente should be

WHERE [DateSent To DTP Service]< "#" & Month([Choose Date]) & "/" & "01/" &
Year([Chose Date]) & "#"

Bye
Cinzia
 
I think what you want is

WHERE [Date Sent to DTP Service] < DateSerial([Specify Year],[Specify
Month],1)

In the query grid that is
Field: [Date Sent to DTP Service]
Criteria: < DateSerial([Specify Year],[Specify Month],1)


Your current expression
 
Thanks, I tried both but it's weird... when I put the less than sign it
still returns no results, but when I change it to the greater than
sign, it returns all entries. I think both formulas work, but it is
something with that less than sign. Any more suggesstions?
 
Please copy and post the SQL of your query.

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message

Also tell us the data type of the field involved.
 
My fault... John, your solutions worked, I was inputting the
WHERE..(haha) ... thanks a lot for the help... your a genius
 
Back
Top