473,378 Members | 1,344 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,378 software developers and data experts.

Find Previous Record

I have a query that has the following fields/data,

ID, Seq, EDate, TDate;
3228, 1, 6/30/2008, 8/7/2008
3228, 1, 6/30/2008, 6/18/2008
3228, 1, 6/30/2008, 3/22/2005
3228, 1, 6/30/2008, 3/21/2000

I need to find the record where TDate is < EDate by 12 months.
I am not sure how to read thru all the records and find out which one has a TDate that is 12 months less then EDate.

Please treat this a urgent.

Thanks
Aug 27 '08 #1
2 2455
ADezii
8,834 Expert 8TB
To find all Records in which TDate is at least 12 Months earlier than EDate, try:
Expand|Select|Wrap|Line Numbers
  1. DateDiff("m",[TDate],[EDate]) >= 12
Aug 27 '08 #2
FishVal
2,653 Expert 2GB
Hello, AccessHunter.

You indeed didn't provide sufficient information on your problem.
It is a good idea to post a query SQL as soon as the whole question is all about the query. Also you havn't specified what do you mean by 12 months difference - is it supposed to be the same date 12 months ago or any date in month-12?

Anyway, below are
WHERE clause for month-12
Expand|Select|Wrap|Line Numbers
  1. ... WHERE DateDiff("m", TDate, EDate) = 12
  2.  
to check for the same date 12 months before just add an additional condition
Expand|Select|Wrap|Line Numbers
  1. ... WHERE Day(EDate) = Day(TDate) AND DateDiff("m", TDate, EDate) = 12
  2.  
Regards,
Fish
Aug 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: george | last post by:
Can anyone help? I query a database and return a result on the column "reference". There might be 7 listings. Each row is displayed in a table, with links through to a detail page. I am working...
5
by: Steve Strik | last post by:
My Problem: I have created a database here at work that is exhibiting some very strange behaviour. Essentially the database is structured in a manner where one table is a master record table...
0
by: KelHemp | last post by:
Greetings, I've been using this site for lots of access help in the past, and it's very helpful! I have a new complexity for you all. Reworking a form to record 70-80 years of oil production on...
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
2
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
4
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
1
Run2Eat
by: Run2Eat | last post by:
i feel like this is a doofus question... but i've created an access form and added a find record button, but when i use the form, the find record button searches the form itself, not the table. all...
7
by: thread | last post by:
Hi all i need to build progression calculator for a record and for this i need to have the possiblity to get the information for the previous record. is it posible to do it or i will need to use...
11
by: jennifersalcido | last post by:
Hello All, I am working with two tables that contain inventory data: 1) INVENTORY contains item_number, description, etc. This data is relatively straight-forward, one record per item_number....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.