Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Create Sequential Numbering
Despina Karayanni 
      
5 years ago
Hello,
I am working on creating sequential numbering in an order database. Here is the problem I have. I enter data in the orderF form, and as soon as I close this form, the OrderT table has been appended (it shows the new entries), but when I open the OrderF again, it is blank (it doesn't keep the data). Can you advise why this may happen? Thank you in advance.
Despina Karayanni OP  @Reply  
      
5 years ago
In the meanwhile, I replaced the form, which functions as it should. However, I keep wondering how could this have happened!
Richard Rost  @Reply  
           
5 years ago
Very strange. Sounds like you got some errant code in there somewhere. Many times I've found solutions by just scrapping a form and starting over. :)
Gregory Smith  @Reply  
    
5 years ago
You can use parts of the code below to add 1 to numbers.  I have cases for serial numbered letters with numbers that look like G-0789.  The code below uses DMax to find the last largest.  The number part is separated from the text part so numbers can be incremented by one, then recombined.  That code looks like:
DoCmd.Requery  'this helps with secondary additions while the form is still open.
DoCmd.GoToRecord , , acNewRec
Dim varResult As Variant
' in DMax(), use the FieldName and the TableName, respectively
varResult = DMax("GenOutSerialNum", "tblGenCorrOut")
' This next part separates (parses) the text from the number part,
' adds 1; then puts the parts back together with leading zeros.
Forms.frmGenCorrOut.[GenOutSerialNum] = Left(varResult, 2) & _
Format(Val(Right(varResult, 4)) + 1, "0000")


For our incoming correspondence, it looks like IC-45678
Me.[IC_series] = Left(varResult, 3) & _
Format(Val(Right(varResult, 5)) + 1, "00000")
DoCmd.RefreshRecord

Gregory Smith  @Reply  
    
5 years ago
Oh, this might help, too.  To help me save, I suppose any entries on the Incoming Correspondence Form, I see, years ago, I added this little note that seems to have been working for me since 2017.  A better solution is probably DoCmd.RunCommand acCmdSaveRecord.  The note to myself in 2017 that just I noticed in the code to create the G-0789 style of numbering after creating a incoming correspondence record looks like:
Private Sub cmdOpenGSeries_Click()
' RefreshRecord to write to table to avoid Dirty Record
' RefreshRecord does same here as SaveRecord.
' DoCmd.RefreshRecord
' 2017-07-22 To save the IC record, replace the command above with:
If Me.Dirty = True Then Me.Dirty = False

DoCmd.OpenForm "frmGenCorrOut", acNormal

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 9:12:53 PM. PLT: 1s