Query to find records almost a year old from input date

rrmando

Board Regular
Joined
Dec 23, 2004
Messages
212
Hello all. I am a rookie with Access and am in need of some help. I am building a W-9 form tracking database. The fields are Vendor Number, Vendor Name, W-9 on File (yes/no), and W-9 Date.

I would like to create a query that locates all of the W-9s that are almost one year old, so that we can contact the vendors annually and ask them to submit a new W-9 form. I am thinking of a query that will let us know which records are 11 months (or more) older than the W-9 Date field.

The W-9 Date field is the date showing as 04/26/04 for example. I would like the query to show us 11 months or more from now which vendors need a new W-9 form on file. Thank you in advance.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Take a look at the DateDiff, DateAdd and Now functions.

Now will return the current date (and time)

DateDiff the difference between 2 dates in a period (day, month etc) specified by yourselh.

DateAdd will add n specified periods to a date.

You should be able to combine these to acheive what you want.

Perhaps SQL like this.
Code:
SELECT W9Table.Vendorname, W9Table.W9Date
FROM W9Table
WHERE (((W9Table.W9Date)<DateAdd("m",-11,Now())));
To create this in the QBE add your table, add the vendor name and W9 date fields.

In the criteria for the date put this:

Code:
<DateAdd("m",-11,Now())
 
Upvote 0
Thank you for the prompt reply Norie. You lost me at the end...did the message get cutoff? Can you please re-post? Thanks again.
 
Upvote 0
It's because the less than operator is also used in the board's markup language.

I'll edit the post - did you understand the rest of it?
 
Upvote 0
You're the man Norie! Thank you so much for your help. If you were here I would hug you. Thanks again.

What is the SQL select, from, and where? Is that the SQL behind the query?
 
Upvote 0
Yes it is.

If you want to see it goto View>SQL while in query design mode.

You shouldn't really need to use SQL, just use the QBE.

It's hard to explain queries without giving an example, that's why I posted the SQL.
 
Upvote 0

Forum statistics

Threads
1,221,905
Messages
6,162,770
Members
451,786
Latest member
CALEB23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top