473,397 Members | 2,028 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,397 software developers and data experts.

date+order

Hi
i need a function that orders the dates in one column from min to max and
then in another column the first date gets the number 1, second =>2, third
=> 3...and so on.
any suggestions
many thanks
J.J.
Nov 13 '05 #1
1 1182
"J.J." <no****@jj.com> wrote in message news:<cb**********@ls219.htnet.hr>...
Hi
i need a function that orders the dates in one column from min to max and
then in another column the first date gets the number 1, second =>2, third
=> 3...and so on.
any suggestions
many thanks
J.J.


You could do this a couple of ways of the top of my head, both are a
little 'hacky'.

You can do it through a function that updates the column like so.

rstTable.open "SELECT * FROM TABLE ORDER BY DateField"
intx = 1
Do until rstTable.EOF

rstTable!OrderNo = intx
rstTable.update
intx = intx +1
loop

Problem with this is that if you are planning to insert new records
into the table you will have to run the function each time to renumber
the records.

To produce the number dynamically (not in a field) will you need a
primary key to also be in the table.

Example data, table1

PK Date
1 12/12/2003
2 12/12/2003
3 01/01/2004

SELECT table1.*, DCount("[PK]","table1","[Date]<=#" & [Date] & "# AND
[PK] < " & [PK])+1 AS OrderNo FROM table1 ORDER BY Date, PK

The reason you need the PK to be present is that is you just use the
date it will be messed up by the duplicate records.

Hope that helps...
Nov 13 '05 #2

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

Similar topics

6
by: bissatch | last post by:
Hi, I am about to write an application that will display all pdf files in a folder and display them by file name in order of date. Is there an easy way of doing this? I was thinking about...
6
by: Stuart Palmer | last post by:
I am trying to compare the current date() with the date in an access db to pull out only records where the date is later than the todays date (so records where the date hasn't passed) Then I do...
0
by: TomT | last post by:
I have created a DB in Access 2000. The Date Field (clientdate) is currently a MEMO field. The date is being entered as: 10 June 2004 21 January 2005 09 September 2004
9
by: Thomas R. Hummel | last post by:
Hello, I am importing data that lists rates for particular coverages for a particular period of time. Unfortunately, the data source isn't very clean. I've come up with some rules that I think...
2
by: david | last post by:
Hi, I have a form with 2 select objects which are not linked together in any way. The list exactly the same information. The code that generates the data is: ...
10
by: Mat | last post by:
Hi, I have a table with two column, date and data I would like to do a set of queries to generate statistics on the data, such as count(data) for month blocks and year blocks. What is the best...
8
by: kaosyeti | last post by:
i have a (hopefully) small problem. i have created a system where a user enters customer information into a table through a form. this table has no primary key. there are 9 fields on the form to...
3
by: | last post by:
Hallo. I would like to make a Query, which gives the order nr to fields of the table. The table has Fields: Date and Notes. And the Query should give the number seriatim by each date. By new date...
4
by: fluff | last post by:
Hello. I want to display some data from a database in a certain order. I have a table with columns A, B, Date. I want to display the records that have data in column A first and I want those...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.