473,545 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Searching for serial numbers

Hi there

I'm trying to find part serial numbers between 2 numbers. The user selects a
part number from a combo box and then enters a range of serial numbers into
2 text boxes and the resulting query should find every machine that has that
part number between the serial number range.

The problem is that the serial number stored is a text field and the results
are not what they should be.

PartNo SerialNoFrom SerialNoTo
A333 100 400

Returns
100
1001
1033A
20000345
285D
309
3987092

The results should be
100
285D
309

What's the best way to create a search form where the items being searched
for are a combination of text and numbers?

Stewart

Nov 12 '05 #1
3 3252
"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:c8******** **@news.wave.co .nz...
Hi there

I'm trying to find part serial numbers between 2 numbers. The user selects a
part number from a combo box and then enters a range of serial numbers into
2 text boxes and the resulting query should find every machine that has that
part number between the serial number range.

The problem is that the serial number stored is a text field and the results
are not what they should be.

PartNo SerialNoFrom SerialNoTo
A333 100 400

Returns
100
1001
1033A
20000345
285D
309
3987092

The results should be
100
285D
309

What's the best way to create a search form where the items being searched
for are a combination of text and numbers?


Assuming the numbers are always at the front of the serial number you could use
the Val() function to return the numeric portion and filter on that. This will
not be very efficient if this is a large database however since filtering on an
expression can not take advantage of any indexes you might have on the field.

SELECT * FROM SomeTable
WHERE PartNo = 'A333'
AND Val(SerialNo) BETWEEN 100 And 400
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #2
Hi Stewart,

I won't try to solve your issue in its entirety. I will characterize some
of the constituent issues and then make a couple of suggestions. The rest
will be up to you or maybe some really, really kind hearted Samaritan will
leap in an take it the rest of the way.

As you already know, that thing you refer to as a Serial Number isn't a
number at all. It is an alphanumeric string in a text field. Not only
that, while the numeric root may progress in a meaningful numeric sequence
the alphabetic post fix character(s) may be from 0 to some undetermined
number of characters in length. While you haven't said so, it is implicit
that the suffixed alpha characters and in alpha sequence as regards the same
root.

Your problem/goal is to return a range of values between two text string
values. If you have to stay with the existing "Serial Number" construct,
you can do it with a fair bit of string manipulation in VBA. [If you have a
good book that tells you about string manipulation in BASIC or VBA you're in
luck. If not, I recommend The VBA Developer's Handbook by Ken Getz et alia
from Sybex]. You'll need two function procedures in a general code module;
one for LowValue and another for HiValue. They will be similar but
different and should return True or False. Your existing query already
returns the "serial number". Leave that field in the query as it is. You
need to create two new fields something like the following - TestLow:
=LowValue(LowSt ring, SerialNumberFie ld) and TestHi: =HiValue(HiStri ng,
SerialNumberFie ld). You can get the values for LowString and HiString as
you are now or by referring to the appropriate control on the form that
launches your existing query [ TestLow: -LowValue(forms! MyForm!txtLowVa lue,
SerialNumberFie ld)]. TestLow returns True if the current value of
SerialNumberFie ld is equal to or greater than LowString otherwise it returns
False. Similar logic applies in TestHi.

If you have total control over the application and the serial numbers, I
recommend that you make it pretty much a machine generated affair with three
parts to the number separated by dashes if necessary; root number, main rev
number, minor rev number.. Given what you've posted, it looks like a paper
system that's been/being "computeriz ed" and I imagine it's woven into the
culture of your company that it just "has" to be the way it is.

As to the code that goes into the two function procedures, it isn't complex
but it requires knowing what you are doing at each step of the way and
paying attention to the details..

hth
--
-Larry-
--

"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:c8******** **@news.wave.co .nz...
Hi there

I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting query should find every machine that has that part number between the serial number range.

The problem is that the serial number stored is a text field and the results are not what they should be.

PartNo SerialNoFrom SerialNoTo
A333 100 400

Returns
100
1001
1033A
20000345
285D
309
3987092

The results should be
100
285D
309

What's the best way to create a search form where the items being searched
for are a combination of text and numbers?

Stewart

Nov 12 '05 #3
Thanks Larry for a well put forward explanation for how to tackle the
problem. It would be good if I could control the serial number's format and
that would make the searching easier but the serial number is the number
given by the maker of the part. A stereo system has a different serial
number format than your TV. In my case my client selects a part number for a
motor and then wants to find all machines that have a serial number that
belongs to that type of motor within a certain range of numbers. Then they
might want to do the same but with a controller which has a different serial
number format.

I'll take your advice onboard and create a couple of functions in VBA and
merge them into my query.

Stewart
"Larry Daugherty" <La************ ********@verizo n.net> wrote in message
news:nh******** *************@n wrddc01.gnilink .net...
Hi Stewart,

I won't try to solve your issue in its entirety. I will characterize some
of the constituent issues and then make a couple of suggestions. The rest
will be up to you or maybe some really, really kind hearted Samaritan will
leap in an take it the rest of the way.

As you already know, that thing you refer to as a Serial Number isn't a
number at all. It is an alphanumeric string in a text field. Not only
that, while the numeric root may progress in a meaningful numeric sequence
the alphabetic post fix character(s) may be from 0 to some undetermined
number of characters in length. While you haven't said so, it is implicit
that the suffixed alpha characters and in alpha sequence as regards the same root.

Your problem/goal is to return a range of values between two text string
values. If you have to stay with the existing "Serial Number" construct,
you can do it with a fair bit of string manipulation in VBA. [If you have a good book that tells you about string manipulation in BASIC or VBA you're in luck. If not, I recommend The VBA Developer's Handbook by Ken Getz et alia from Sybex]. You'll need two function procedures in a general code module; one for LowValue and another for HiValue. They will be similar but
different and should return True or False. Your existing query already
returns the "serial number". Leave that field in the query as it is. You
need to create two new fields something like the following - TestLow:
=LowValue(LowSt ring, SerialNumberFie ld) and TestHi: =HiValue(HiStri ng,
SerialNumberFie ld). You can get the values for LowString and HiString as
you are now or by referring to the appropriate control on the form that
launches your existing query [ TestLow: -LowValue(forms! MyForm!txtLowVa lue, SerialNumberFie ld)]. TestLow returns True if the current value of
SerialNumberFie ld is equal to or greater than LowString otherwise it returns False. Similar logic applies in TestHi.

If you have total control over the application and the serial numbers, I
recommend that you make it pretty much a machine generated affair with three parts to the number separated by dashes if necessary; root number, main rev number, minor rev number.. Given what you've posted, it looks like a paper system that's been/being "computeriz ed" and I imagine it's woven into the
culture of your company that it just "has" to be the way it is.

As to the code that goes into the two function procedures, it isn't complex but it requires knowing what you are doing at each step of the way and
paying attention to the details..

hth
--
-Larry-
--

"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:c8******** **@news.wave.co .nz...
Hi there

I'm trying to find part serial numbers between 2 numbers. The user selects
a
part number from a combo box and then enters a range of serial numbers

into
2 text boxes and the resulting query should find every machine that has

that
part number between the serial number range.

The problem is that the serial number stored is a text field and the

results
are not what they should be.

PartNo SerialNoFrom SerialNoTo
A333 100 400

Returns
100
1001
1033A
20000345
285D
309
3987092

The results should be
100
285D
309

What's the best way to create a search form where the items being

searched for are a combination of text and numbers?

Stewart


Nov 12 '05 #4

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

Similar topics

21
43000
by: Gavin | last post by:
Hi, I'm a newbie to programming of any kind. I have posted this to other groups in a hope to get a response from anyone. Can any one tell me how to make my VB program read the Bios serial number (or would HDD be better, or both?) and put that info into VB prog so the program won't work on another computer. My program uses an MSAccess table....
21
3068
by: nephish | last post by:
i have an interesting project at work going on. here is the challenge. i am using the serial module to read data from a serial input. it comes in as a hex. i need to make it a binary and compare it bit by bit to another byte. They have some weird way they set this up that i have to compare these things with AND. in other words, if bit 1 is 1...
1
2811
by: Darren DeCoste | last post by:
I am trying to create an application in Access that I will be able to print bar code labels. A stumbling block that I have hit is the Serial Number on the bar code. I would like to be able to read the Serial number from a Customer table. This serial number just starts at 10000 and goes up. This number is incremented everytime a label is...
3
9815
by: Gianmaria | last post by:
Anyone knows how can i get the cpu serial or the hd serial of the machine runnig the application with c#? regards Gianmaria
33
2444
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following criteria: I have a list of about 100 numbers which correspond to the ID field and also another 40 say numbers corresponding to the numbers in the...
0
2174
by: Ryan Liu | last post by:
How to read NIC card serial numbers or MAC address , Hard Drive serial numbers in Java or Delphi or C/C++ or C#? Thanks, Ryan
3
8080
by: Bayazee | last post by:
Hi, How can I get CPU Serial number , or motherboard serial number with python . I need an idetification of a computer .... ThanX --------------------------------------------------- iranian python community --www.python.ir
6
30693
by: Paul Bromley | last post by:
Ok - I have given up on trying to find the active IP address for a given PC. For licensing purposes I need to retrive a unique identifier from the PC that the program is installed on. The Hard disk serial number would do fine, but on Googling it seems that some of the sample code will now laways work on W2K, and not without administrator...
2
8131
blyxx86
by: blyxx86 | last post by:
Great insight needed!! Good evening everyone.. I've come to a point where I can't even fathom how to go forward. I'm attempting to create a serialized inventory. I don't know where to begin. I need to keep a running inventory of serials by customer, by model and then by serial. Customer 1>Model1>Serial1
0
7478
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...
0
7923
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5984
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...
0
4960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
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
1
1025
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.