Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Sequential Annual Coding < Scope | DateSerial >
Back to Sequential Annual Coding    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Renumbering
Pawel Stepnowski 
    
3 years ago

Hi Richard, first I would like to congratulate you on another excellent video, however I would like to ask if there is a way for access to assign a number to that date from the beginning, keeping the date sorted from the earliest to the latest. Thank you for your help.
Scott Axton  @Reply  
          
3 years ago
I'm not quite understanding what you want to accomplish.  Could you type out a little example of what you are describing?
Pawel Stepnowski OP  @Reply  
    
3 years ago
I will present what I would like to achieve on an example:
I have 4 records with assigned dates in a continuous form e.g.
1 - 2021/1/1
2 - 2021/1/10
1 - 2022/1/3
3 - 2021/1/7

After entering the date, e.g. 2021/1/6, I would like Access to reassign the number of each entered date and finally it looked like this:
1 - 2021/1/1
2 - 2021/1/6
3 - 2021/1/10
1 - 2022/1/3
4 - 2021/1/7
Kevin Yip  @Reply  
     
3 years ago
What is the relationship between the number and the date?  If the numbers represent the order for sorting the dates, why does Jan 10th 2021 come before Jan 7th 2021?
Richard Rost  @Reply  
          
3 years ago
Like Scott and Kevin said, we'd need to know more about your rules. It looks like the count restarts with a new year, but I don't get how you're sorting the dates inside a year.
Pawel Stepnowski OP  @Reply  
    
3 years ago
In the example I gave, there is no relationship between the date and the number, I strive to ensure that access:
- at the beginning of the year, it assigned a number to the entered date starting from 1,
- after entering the date, it sorted all entered dates from the smallest to the largest in a given calendar year and then assigned a number to each entered date, starting from assigning a number. 1 the earliest date in that particular calendar year
Kevin Yip  @Reply  
     
3 years ago
Hi Pawel, if you want to store these numbers in the same table that has the dates, then you may use VBA to create a Recordset with your dates sorted, then loop the Recordset to store the numbers.  The sample code below stores ascending-ordered integers for ascending-ordered dates:

    Dim r As Recordset, i As Integer
    Set r = CurrentDB.OpenRecordset("SELECT MyNum, MyDate FROM MyTable ORDER BY MyDate")
    r.MoveFirst
    i = 1
    Do While Not r.EOF
        r.Edit
        r!MyNum = i
        r.Update
        i = i + 1
        r.MoveNext
    Loop
    r.Close
Pawel Stepnowski OP  @Reply  
    
3 years ago
Thank you very much for your support and your time - everything is working fine.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Sequential Annual Coding.
 

Next Unseen

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 12/11/2025 5:51:18 PM. PLT: 1s