473,802 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1560
On 3 Nov 2005 08:20:23 -0800, em**********@gm ail.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**********@gm ail.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
3703
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example program #include <list>
7
5498
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 that an xpath expression can be bounded by either single or double quotation marks. But sometimes I want to search for a title containing both a single and double quote. Any way to do this?
3
1906
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 odbc, or by using a parameter query that's customized in code for each search, I was able to find a simple and fast solution based on the same native Access SELECT query I used previously with native Access tables. In my example I open an...
6
1369
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 of the form looking at that value sin the combo boxes and handling everything loverly but when i try to use the data from the list box, it all goes a bit wierd...
12
3438
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 to work only to see that it takes 30-60 seconds to run the query, instead of the usual .5 seconds when I use a query without a function. Here is the code for the function. I call it using
2
2079
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. The idea is to copy the current record I am viewing in the form, to another table. I want to simple execute a stored query but I get a run-time error 3061, too few parameters. Expected 1. So even though I've specified the control within the...
27
4625
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 = $doc->loadHTMLFile("./aBasicSearchResult.html"); if ( $res == true ) { $zip = $doc->getElementById('zipRaw_id')->value; if ( 0 != $zip ) {
3
4980
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 version="1.0" encoding="utf-8" ?> <thing xmlns="urn:thing-schema-v1"> <foo>foo thing</foo> <bar>bar thing</bar>
9
19161
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 ------------------------- SELECT * FROM ( Select x.event_date From x FULL OUTER JOIN y ON x.event_date = y.event_date
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10536
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10304
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.