473,657 Members | 2,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Number entry (leading zeros)

LFM
I am sure there is a simple answer.

I have a database that where I am trying to setup a security login
based on employee number.

Employee number is a 5 character numeric field. The databse has a sql
odbc link into the HR system to pull the emp number, emp name, and a
few other key fields. Because of the way the sql/odbc link is - this
field is a text field

Example emp numbers are:
00063
01222

On the login form, I have an unbound text box.

I've put an input mask of "00000" and default value of 0

I would like to make it so that the data entry starts from the right
side of the box. In otherwords, I would like to make it so that if the
person with employee number 63 goes to login, he only needs to type in
63 and not 00063. I would like the field to automatically add the
preceeding zeros if necessary.

Aug 8 '06 #1
3 3084
LFM wrote:
I am sure there is a simple answer.

I have a database that where I am trying to setup a security login
based on employee number.

Employee number is a 5 character numeric field. The databse has a sql
odbc link into the HR system to pull the emp number, emp name, and a
few other key fields. Because of the way the sql/odbc link is - this
field is a text field

Example emp numbers are:
00063
01222

On the login form, I have an unbound text box.

I've put an input mask of "00000" and default value of 0

I would like to make it so that the data entry starts from the right
side of the box. In otherwords, I would like to make it so that if the
person with employee number 63 goes to login, he only needs to type in
63 and not 00063. I would like the field to automatically add the
preceeding zeros if necessary.
In your AfterUpdate event of the field you could do something like
Me.SecID = Right("00000" & Me.SecID,5)
Aug 8 '06 #2
You can do this by inserting the following code:

Public Function InsertZeros(Dig its As String)
Dim intZeros As Integer
For intZeros = 1 To 5 - Len(Digits)
InsertZeros = InsertZeros & "0"
Next
InsertZeros = InsertZeros & Digits
End Function

This is a function that return the string with the zeros added to the
front.

You can run it from the debug window if you want to test it, by typing:

? insertzeros (63)

Will return:

00063

Good luck

Nick
LFM wrote:
I am sure there is a simple answer.

I have a database that where I am trying to setup a security login
based on employee number.

Employee number is a 5 character numeric field. The databse has a sql
odbc link into the HR system to pull the emp number, emp name, and a
few other key fields. Because of the way the sql/odbc link is - this
field is a text field

Example emp numbers are:
00063
01222

On the login form, I have an unbound text box.

I've put an input mask of "00000" and default value of 0

I would like to make it so that the data entry starts from the right
side of the box. In otherwords, I would like to make it so that if the
person with employee number 63 goes to login, he only needs to type in
63 and not 00063. I would like the field to automatically add the
preceeding zeros if necessary.
Aug 8 '06 #3
did you try format?
?Format(202,"00 000")
00202

you could put it in the BeforeUpdate property of the control.

Aug 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
11496
by: samik_tanik | last post by:
I need to export a datagrid to Excel. I could did this. But, also need to keep the leading zeros in the data. How can I acheive this? Any help would be appreciated. -- Thanking you in anticipation, Regards,
2
2429
by: Reggie | last post by:
It's kicking my butt. All I want to do is add 1 to each new records I add to my table using a form. The serial number is in the form 0001, 0002, 0003 etc, and increments for each record. If I enter the value in the table directly it retains the leading zero's however if I use the dmax function and add one to it it's store as 1, 2, 3 etc. I'm stumped. Can I do this as a default value in the table? Any advice is appreciated. Thanks in...
3
2022
by: jj | last post by:
example is I'm finding the max number within a certain criteria, and then adding one to that. However, most IDs are something like K00001 or R00223 So I want the next ID to be either K00002 or R00224 Unfortunately Access is stripping out the leading 0s leaving me with an ID of K3 or R224. With PHP I'm able to do something like:
8
2455
by: shumaker | last post by:
I see other posts where some say fields that will hold a number with leading zeros should be stored as text instead of numbers. This is very inefficient though, as a string of digit characters takes up much more memory than a 32bit or even a 64bit int. Storing as a number still allows for formatting when displaying the number, correct? I am creating a table and would like opinions regarding this please.
3
3294
by: brad.goldberg | last post by:
Hey All, I know this has been addressed in a few different conversations but none are exactly what I am trying to do, bear with me I am an access Newbie. Basically I have a form that assigns Run Numbers to each record (EMS agency, each record is a Run Number, versus like a PO number or Work Order..).
4
11777
by: HandersonVA | last post by:
will it be possible to increase number as below automatically 00000001 00000002 00000003 .... whenever the row is inserted, number will be increased like above format. which data type should I select and do some other setting to record like that?
29
2461
by: fdmfdmfdm | last post by:
let's say without checking including files, how do we to represent the biggest say int in a system? I ran across a book give this code: long int biggest = 0x7FFFFFFF; Does that mean the long int at that system is only 32 bits? If we know in a particular system, the long int is 64 bits, shall we write:
23
9770
by: neha_chhatre | last post by:
which is the best format specifier(data type) if i have to work with decimal number. also please tell me the syntax for truncating a decimal number please reply as soon as possible
0
4091
by: Monty | last post by:
Hi All, I am having a problem with leading zeros being stripped from fields in a CSV file when I bring them in using Jet/OleDB. In VB.Net/VS 2008, I am accessing a CSV file like so: sSQL = "SELECT * FROM " sConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Microsoft.VisualBasic.FileIO.FileSystem.GetParentPath(msFile) & _
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.