|
-
Mar 4th, 2006, 10:12 AM
#1
Thread Starter
Member
Need help creating an increment field VBA
I need to create a field named “casenumber” that will contain increment number value for each record (similar to “AutoNumber”) but I need it to reset to 0001 at the first of each month. I am using Access 2000.
Thanks in advance
-
Mar 6th, 2006, 06:08 AM
#2
Re: Need help creating an increment field VBA
No idea why you'd want to reset it.

Make a table of one row and one column. Put your number in there. When saving the new record, get the number from this table, increment it and update that then create your new record with the number you retrieved.
Then every month you can change the number back to 0... or 1...
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Mar 6th, 2006, 01:38 PM
#3
Thread Starter
Member
Re: Need help creating an increment field VBA
This field is used in a database that tracks criminal offences on a monthly basis. Each occurrence is identified by a “case number” which is broken down as follows: 06-03-0001 .06 = Year 03 = Month 0001 represents the individual criminal activity for that time period.
Again thanks for any help
carbo
-
Mar 6th, 2006, 04:09 PM
#4
Frenzied Member
Re: Need help creating an increment field VBA
I don't have time to work on this right now, but one approach is to set up a Global variable for the Item Sequence number (case number) and a Global Boolean flag "gb_Updated".
Set up a macro that runs when the workbook opens. This is NOT code ... it is just what I wold have the macro do:
If (day of month) > 15 then gb_Updated = False
if (day of month <= 15) AND (gb_Updated = False) then
gi_CaseNum = 1
gb_Updated = True
Are you guaranteed to have at least ONE case during the first half of the month? This will update the Case Number only One Time anytime during the first half of the month (it doesn't have to be on the very first day of the month!). Can you take it from here? If not, I'll post more Wednesday.
Last edited by Webtest; Mar 6th, 2006 at 04:12 PM.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Mar 6th, 2006, 10:13 PM
#5
Thread Starter
Member
Re: Need help creating an increment field VBA
Typically there are from 800-1500 entries per month.
Thanks
carbo
-
Mar 6th, 2006, 10:21 PM
#6
-
Mar 7th, 2006, 08:03 AM
#7
Thread Starter
Member
Re: Need help creating an increment field VBA
This MsAccess 2000 database is for a 911 Center that assigns case numbers to various law enforcement agencies as well as other emergency services type disciplines. It is a centralized repository for “Master Name Index” information.
-
Mar 7th, 2006, 08:05 AM
#8
Re: Need help creating an increment field VBA
I would recommend that you get them off of Acccess then as its not really scallable enough and is subject to corruption issues if your not careful in its design and code access.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 7th, 2006, 06:36 PM
#9
Thread Starter
Member
Re: Need help creating an increment field VBA
Would it be your assertion that a MsAccess database, created in a “flat file” format, be equally susceptible to corruption as a “relational” format?
Last edited by carbo; Mar 7th, 2006 at 08:22 PM.
-
Mar 8th, 2006, 02:48 AM
#10
Re: Need help creating an increment field VBA
A flat file would be stable but it is also a nightmare to manage.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 12th, 2006, 11:06 AM
#11
Thread Starter
Member
Re: Need help creating an increment field VBA
I still have not resolved this issue; any and all help will be greatly appreciated.
Thanks
Carbo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|