473,379 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Simple Query Help Needed

I have a table called tbl_employers. One of the fields is start_date.
I'm trying to make a query that will show all entries where todays date
is 275 days and 305 days after the start date.

Any help would be appreciated

Nov 13 '05 #1
5 1543
On 3 Nov 2005 08:20:23 -0800, em**********@gmail.com wrote:
I have a table called tbl_employers. One of the fields is start_date.
I'm trying to make a query that will show all entries where todays date
is 275 days and 305 days after the start date.

Any help would be appreciated


Do you mean between 275 and 305 days?

Select tbl_employers.* From tbl_employers
Where tbl_employers.[Start_Date] Between DateAdd("d",-275,Date()) and
DateAdd("d",-305,Date())

or exactly 275 and exactly 305 days?

Select tbl_employers.* From tbl_employers
Where tbl_employers.[Start_Date] = DateAdd("d",-275,Date()) Or
tbl_employers.[Start_Date] = DateAdd("d",-305,Date())

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 13 '05 #2
Good point. I was planning on having them run the query every day but
that would not cover weekends.

Basically I needed a query that shows what entries are 90 days from
expiration , what ones are 60 days from expiration and what ones are
365 days or more.

The 365 or more was easy it's the other two that are causing problems
for me. I'll try your code samples. I'm using

DateDiff("d",[SHARP Begin Date],Now())
Then using >=365 for the expired ones
=274 for the 90 Day warnings which also bring the ones that are over a year old and I don't want them
and lastly
=305 for the 60 day warnings which is also bringing the ones that expire in 90 days and expired ones.


Nov 13 '05 #3
On 3 Nov 2005 12:47:51 -0800, em**********@gmail.com wrote:
Good point. I was planning on having them run the query every day but
that would not cover weekends.

Basically I needed a query that shows what entries are 90 days from
expiration , what ones are 60 days from expiration and what ones are
365 days or more.

The 365 or more was easy it's the other two that are causing problems
for me. I'll try your code samples. I'm using

DateDiff("d",[SHARP Begin Date],Now())
Then using >=365 for the expired ones
=274 for the 90 Day warnings which also bring the ones that are over a year old and I don't want them


and lastly
=305 for the 60 day warnings which is also bringing the ones that expire in 90 days and expired ones.


Using Now() in the expression is not a good idea.
Now() includes a time value, therefore the number of records returned
will depend upon the time of day the query is run.
Use Date() instead.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 13 '05 #4
Thank you for thaty suggestion I'm going to change them to Date.

How would I write the expression 61 to 90 days instead of just 90 days?

Nov 13 '05 #5
Scratch that. I figured out I can use <= at the end of the expression
to limit what shows and it all looks good.

Thanks for all the help Fred. I hope this helps others as well

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
7
by: Ot | last post by:
I posted this to the wrong group. It went to m.p.dotnet.languages.vb. Ooops. -------------------------------------------------------------------- I have this tiny problem. I have learned...
3
by: Bob C. | last post by:
When I migrated my tables to SQL Server I needed a way to overcome the slow performance of the Find method on my recordsets. Although this can be done by accessing the table directly using dao and...
6
by: dkintheuk | last post by:
Hi all, I have a form with some unbound combo's and a list box that are used to requery the dataset behind the form. All was working fine until i added the list box. I have the record set...
12
by: strict9 | last post by:
Hello all, I'm writing several queries which need to do various string formating, including changing a phone number from (123) 456-7890. After some problem with data mismatches, I finally got it...
2
by: Deano | last post by:
Problem is that there are lots and lots of fields in an employee record. I specify a form control as the criterion for one of those fields which is the value of the primary key for that record. ...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
3
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
9
by: Emin | last post by:
Dear Experts, I have a fairly simple query in which adding a where clause slows things down by at least a factor of 100. The following is the slow version of the query ...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
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...
0
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,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.