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

How to reset number to 0 or 1 when new dates occurs?

180 100+
How to reset incrementing numbers to 0 or 1 when new date occurs?
Aug 24 '10 #1
2 1128
reginaldmerritt
201 100+
When you say incrementing number do you mean that you have a field with an AutoNumber data type?
Aug 24 '10 #2
reginaldmerritt
201 100+
Assuming that you have a field which allows user to enter today's date.

You can change the [IncrementingNumber] field to a Number data type rather than an AutoNumber data type. Then you can try this code on a Form_Load event for a new record.

Expand|Select|Wrap|Line Numbers
  1. If DMax("[DateField]", "TABLENAME") < Date Then
  2.     'Reset increment Number
  3.     Me.IncrementingNumber = 0
  4. End If
  5. If DMax("[DateField]", "TABLENAME") = Date Then
  6.     'Increment Number = Last Increment Number + 1
  7.     Me.IncrementingNumber = (DMax("[IncNum]", "TESTTABLE", "[DateField] = #" & Date & "#") + 1)
  8. End If
I hope that helps.
Aug 24 '10 #3

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

Similar topics

3
by: Bruno G. | last post by:
Hello! Is it possible for IIS to send some sort of notification when an ASP error occurs on a page? I can see them in the web logs, but I was wondering if there was a way to receive an email...
1
by: rock72 | last post by:
Hello Everyone, Can you tell me how to produce a query that when Login Date (entry) is Sunday. First, check if the Sunday Date occur on 7th day of his duty. Example 1: Login Date no. of...
5
by: John Bowman | last post by:
Hi, I need some dialog handling help, I must be missing something obvious here but I can't figure out the solution to the following problem... Simple Win Forms app that has button on the form....
3
by: Lloyd Sheen | last post by:
Is there a setting in VS2003 to ensure that when debugging a page it will stop on all errors. At present it just displays a page with the error but I want it to stop at that line when the error...
5
by: Andy G | last post by:
Hi, My plan is to use Try Catch statements to catch an error and then email it to myself. I send the user to a custom error page and I would like to email myself the asp.net error. I thought...
1
by: Li Pang | last post by:
Hi, I'd like to know the easiest way to get a row number when clicking on a listview. Thanks
22
by: Kd | last post by:
I have the following set up to give me aresponse number R05-001 I would like it to reset to R06-001 at new year ResponseNo: "R" & Right(Format(Date(),"yyyy"),2) & "-" & Format(,"000") This is...
2
mkremkow
by: mkremkow | last post by:
Access 2003 on XP Someone here at work deleted a record (&$%^&*&!!!) and screwed up the Autonumber "Job ID" field . I need to reset the Autonumber field back to it's original numbers and still...
8
by: Wayne L | last post by:
I have searched and could not find my solution to my problem. I have a table that has a field that I want to start at 0001 and go to 1999. Once it reaches 1999 I want the field to reset to 0001. I...
3
by: ramya naidu | last post by:
Hai iam working on a project were i have some textboxes in that one textbox should allow only digits from 0 to 360 and for that i have a error provider when i enter 361 the error provider blinks i...
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: 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: 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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.