Computer Learning Zone CLZ Access Excel Word Windows

The function of education is to teach one to think intensively and to think critically. Intelligence plus character - that is the goal of true education.

-Dr. Martin Luther King Jr.
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Access >
Back to TechHelp    Comments List
Upload Images   @Reply   Bookmark    Link   Email  
Product Numbers
Richard Van Wagoner 
      
6 months ago
I am starting a new database but have run into a problem. I have created a table and form for my products. And I want to add an automatic product number for each product incremented by one. I have one product in my table that I have given the product number of 1001. But when I add the next the number given is 1 and the next one is also 1. I have some screen shots of the code I have. Can you tell me what I have done wrong?
Richard Van Wagoner OP  @Reply  
      
6 months ago

Richard Van Wagoner OP  @Reply  
      
6 months ago

Adam Schwanz  @Reply  
            
6 months ago
Add some Msgbox LargestProductNumber along the way to see what it's set to. Or step into the code and see the values. Make sure it's finding the correct starting point, and adding 1 to it.

Is ProductNumber a number or text?
Adam Schwanz  @Reply  
            
6 months ago
Also what is the second textbox / field for? The AssignNextProductNumber.

Your code could be dumbed down a lot to be simpler
If Not IsNull(ProductNumber) Then
Msgbox "Already"
Exit Sub
End If

ProductNumber = NZ(DMAX("ProductNumber","ProductT"),0)+1
Richard Van Wagoner OP  @Reply  
      
6 months ago
Thanks I just changed the last line and it works fine now
Kevin Robertson  @Reply  
          
6 months ago

Kevin Robertson  @Reply  
          
6 months ago
Oh. Guess I was too slow. LOL
Richard Van Wagoner OP  @Reply  
      
6 months ago
That's Fine, you have added a little more information on how to start with a specific number. Thank you

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

 
 
 

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: 5/17/2025 8:05:04 PM. PLT: 1s