473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how to remove leading zeros from numbers when I do CTRL + F?

Hi,

I have a simple ms access application that allows you to scan barcodes
in to a form which stores them in the database. The barcodes are 6
digits in length e.g. 555666 but my handheld scanner always adds a
leading zero - e.g. 0555666. You can get round this problem by
changing the database design for the field where this is stored from
text to number format.

However, when it comes to quickly doing a search for a code - CTRL + F
- the scanner still puts the code into the search box with the leading
zero. Is there a good way of stopping this? Would this be something I
could code via a macro?

(the long-term solution has to be to find the manual and scan a system
code that removes the leading zero)

Any suggestions??

Apr 11 '06 #1
2 5617
The start to finding a solution for your problem is to explain the
problem in a little bit more detail. When you say the scanner puts the
code into a search box - what is this searchbox? How does the data get
from the scanner get to the Access table? Obviously, there is some
serial port program that reads the data, and then you are retrieving the
value from this program. You need to intercept the data before it gets
to the table and cast the text value to a numeric value:

fldx = Int(valueFromScanner)

fldx = Int("00054321")

will store this value as 54321 in fldx

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Apr 12 '06 #2
There are a few solutions to this. The first is to simply store the
numbers as text, with the leading zeros intact.

Another less drastic approach would be to simply change the display
format of the numbers that you're storing. Go into table design view
and set the Format property of that field to 0000000. Now, even though
the numbers will display in your application with the leading zero,
what will be stored is simply the number minus the leading zeros. What
this will allow you to do is to use ctrl-f to find those numbers using
a bar code entry in the 'Find what:' box since they are being displayed
with a leading zero.

Last but not least you may want to build a custom 'find' form that has
the behavior you require.

Bruce

Apr 14 '06 #3

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

Similar topics

6
by: david | last post by:
Hi, I have an application as follows: MySQL database Back-Eend linked to MS Access Front-End and ASP Web Application. I require users to enter Serial Numbers such as: 0105123567 (10...
2
by: r.magdeburg | last post by:
//please tell me why... //and give me a hint to solve the problem with leading zeros. //snippet #include <iostream.h> #include <conio.h> int main() { int zahl = 0; cout << "Give me an int...
7
by: david | last post by:
Hi, I have 2 text boxes on an ASP form. A user enters a Serial Number in TB1 such as 0105123456, presses tab to move to TB2, TB2 then displays the value of TB1 after a calculation has been...
8
by: TheTeapot | last post by:
Hi all, Here's a puzzle: // Say I have an array of numbers set up like so: $arr = array(15,16,17,100,121,1000); // How can I create a function so that I can use it like so:...
5
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...
5
by: OneDay | last post by:
I've got a field that has some old data with text in it, but all forward data will be a 3 digit number. But many of the numbers are still only 2 digits. I would like to force the leading zero in...
6
by: JimmyKoolPantz | last post by:
Task: Customer wants a script of the data that was processed in a "CSV" file. Problem: Zip-Code leading zeros are dropped Basically we have a client that has requested a custom script for...
0
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 =...
2
by: Smokey Grindel | last post by:
I basically need to remove any leading zeros and hyphens from a string... regex seemed like the best rout and using a replace regex method... anyone know of any good strings for this? The one I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...

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.