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

MS Access: Calculate date interval between records in a table

I'm beginner and getting following error message, please help.
The table contains transaction date, account number, branch, etc. And need to show previous transaction date or next transaction date of the account number next to each record,
then calculate date interval.
Thank you in advance,
Sean,
----error message----
"You tried to execute a query that does not include the specified expression 'NEXTDATE' as part of an aggregate function.
----access query----
SELECT A.TRDAT7, B.TRDAT7 AS NEXTDATE, DateDiff("d",A.TRDAT7,NEXTDATE) AS dateinterval, A.BRANCH, A.TRACCT
FROM LNREDFLAG AS A LEFT JOIN LNREDFLAG AS B ON (A.TRACCT=B.TRACCT) AND (A.TRDAT7<B.TRDAT7)
GROUP BY A.TRDAT7, A.BRANCH, A.TRACCT;
Nov 14 '08 #1
1 4457
PianoMan64
374 Expert 256MB
I'm beginner and getting following error message, please help.
The table contains transaction date, account number, branch, etc. And need to show previous transaction date or next transaction date of the account number next to each record,
then calculate date interval.
Thank you in advance,
Sean,
----error message----
"You tried to execute a query that does not include the specified expression 'NEXTDATE' as part of an aggregate function.
----access query----
SELECT A.TRDAT7, B.TRDAT7 AS NEXTDATE, DateDiff("d",A.TRDAT7,NEXTDATE) AS dateinterval, A.BRANCH, A.TRACCT
FROM LNREDFLAG AS A LEFT JOIN LNREDFLAG AS B ON (A.TRACCT=B.TRACCT) AND (A.TRDAT7<B.TRDAT7)
GROUP BY A.TRDAT7, A.BRANCH, A.TRACCT;
As long as the dates are different, then you would not use NextDate in your DateDiff Function, you would simply place B.TRDAT7 in place of NEXTDATE

Let me know if that workes.

Thanks,

Joe P.
Nov 17 '08 #2

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

Similar topics

5
by: Tencip | last post by:
Hi everyone, I'm trying to build a simple script that does the following. It should find today's month and year, and then go into a DB query string and look for all records that are from this...
4
by: DCM Fan | last post by:
{CREATE TABLEs and INSERTs follow...} Gents, I have a main table that is in ONE-MANY with many other tables. For example, if the main table is named A, there are these realtionships: A-->B...
3
by: Iain Miller | last post by:
Can anybody help me with some Access 2000 code? I don't do a lot of coding in Access & so every time I come back to do something I pretty much have to relearn the syntax from scratch so this is...
35
by: deko | last post by:
Do I get more scalability if I split my database? The way I calculate things now, I'll be lucky to get 100,000 records in my Access 2003 mdb. Here some math: Max mdb/mde size = 2000 x 1024 =...
6
by: Jean | last post by:
Hi, I am using an Access 2000 front-end to an Oracle 9 backend. I want to write a query that returns all records that are not older than one year for Column "Status_30" (which is a Date). ...
1
by: KRSharp | last post by:
I am new to Access, so bear with me. I think this is possible, but I am not sure how to get this going. I am trying to develop a database that will allow me to create a manufacturing schedule...
3
by: perfectclick.ng | last post by:
I'm a beginner of MS Access, I need adequate knowledge on how to programme. I have a challenge in my office to write a pragramme that will calculate a compensation for all our distributors. This is...
1
MMcCarthy
by: MMcCarthy | last post by:
Access has a number of built-in functions which can be generally used in queries or VBA code. Some of the more common ones are: Note: anything in square brackets is optional Date Functions ...
15
by: student4lifer | last post by:
Hello, I have 2 time fields dynamically generated in format "m/d/y H:m". Could someone show me a good function to calculate the time interval difference in minutes? I played with strtotime() but...
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
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.