|
-
Sep 4th, 2005, 07:47 AM
#1
Thread Starter
Lively Member
Generating a form number
I am currently creating a form, for which I want to generate an automatic number reference.
The number will be based on the current month/year, followed by a 3 digit sequential number, e.g. 0905-001. I want this sequential number to start at 001 then every time the form is opened it will read previous forms that have been saved in a particular location and take the next number. If there is no previous form for that month, I want the number to start again at 001.
Another problem I must consider is if 2 or more people open the form at the same time because, until the form is saved the number will not be reserved. How can I prevent the same number being allocated twice?
I am new to vba and, although I have several books, I can't seem to find anything that will provide a solution.
Any help, even a pointer on what topic to research, will be much appreciated.
-
Sep 4th, 2005, 10:04 AM
#2
Re: Generating a form number
Welcome to the Forums.
You may want to not create the numbering until the user clicks save. Then you can check what is the correct numbering. If by chance some two users save at the same time it will still only be a second or so during the actual save process until the other one wil detect it and increment the other forms numbering. Probably safe tosay its ok in a multiuser environment.
You can use Date and Format to generate your date format. 
How are these forms saved as? Which office app are you using and version?
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 
-
Sep 4th, 2005, 11:05 AM
#3
Thread Starter
Lively Member
Re: Generating a form number
Soryy, I forgot to mention - the forms are created in Word 2003 and will be saved as .doc.
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
|