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 Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Storing Numbers
Richard Lanoue 
    
6 years ago
In a Number field in the table, I'd like to store 06 as 06.  The Database field, however, stores it as 6. I know with dates and other types of fields can have an input mask of 9 and 0.  Can you do something like this with number fields.
Richard Rost  @Reply  
          
6 years ago
If you need to perform calculations on the value (sum, average, max, min, etc.) then store it as a number. You can always display it with whatever format you want. For example, to force a number to display with two digits make the format 00. In a query or VBA you can say:

Format(MyValue,"00")

If you don't need to perform calculations, then you can use short text and save it however you want.
Richard Lanoue OP  @Reply  
    
6 years ago
What I want to do is measure the length for example If Len(BirthMonth)2 Then...  The problem is not all months are two-digits.  I tried Len(Format (BirthMonth, "00"))2  but no effect...  What do you recomend?
Richard Rost  @Reply  
          
6 years ago
Why use the length for a numeric field when a normal inequality will do just fine?

If BirthMonth<10 then ...

What are you trying to do?
Richard Lanoue OP  @Reply  
    
6 years ago
Same old problem.  on an OnChange event     If BirthMonth  9 Then BirthDay.SetFocus.  It doesn't understand that when I type 01 that's it.  when it defaults back to 1, it thinks it could be 10,11,12....etc.  I want it to know that 01 is two digits, therefore, go to next field.
Richard Rost  @Reply  
          
6 years ago
I'm still not understanding why you need two digits. Sorry! If you want to display it with two digits, then just make the format: 00
Richard Lanoue OP  @Reply  
    
6 years ago
I want it so when it measure that tw0 digits are entered (be it 01 or 11) that it will auto tab to next cell.  It works great in months October, November and December.  On months 01 to 09, however, it expects another digit even though I types in 09 for example.
Richard Rost  @Reply  
          
6 years ago
OK, how about:

If Len(CStr(MyField))>=2 Then ...

Convert the field to a string first, then check its length?
Richard Lanoue OP  @Reply  
    
6 years ago
Still No dice.  It ignores the 0 before any number and doesn't count it as a digit.  For what it's worth this would be a great tutorial for moving a cursor to the next field after you type so many numbers.
Richard Rost  @Reply  
          
6 years ago
Let me get this straight though... you want to STORE the data as a number, but DISPLAY it as 01, 02, 03, etc. Also, as soon as you type in TWO digits, you want the focus to move to the next field. Is that correct?
Richard Lanoue OP  @Reply  
    
6 years ago
That is correct!
Richard Rost  @Reply  
          
6 years ago
OK. You got it. There's an easy way and a slightly more complicated, but more flexible way. You'll be today's TechHelp video. Stay tuned...
Richard Lanoue OP  @Reply  
    
6 years ago
Thank you
Richard Rost  @Reply  
          
6 years ago
Your video is ready: AutoTab to Next Field

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access 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/8/2026 2:45:33 AM. PLT: 0s