473,396 Members | 1,871 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,396 software developers and data experts.

Tracking/sequence numbers

Mike,
I have databse that creates a "tracking number" based on the selections made on the form via concatenating. At the end of the tracking number, I need a two digit (01-99) sequence number by product group for each customer. Hpw do I do this without creating a table for each customer and each product group with autonumbers. For example based on the entries in this sample, the desired result would be:

Customer Business Unit Tracking
Dealer Group Binders 01
Dealer Group Office Labels 01
Forms & Supply Binders 01
Dealer Group Binders 02

It is Dealer Group's second Binder entry so 02.

Please Help!

Thanks!

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
3 2783
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Why do you need a tracking number per Customer/BusinessUnit? If you
want to count how many times a Customer [something] in/with a Business
Unit you could just use the SQL COUNT(*) function. E.g.:

SELECT Customer, BusinessUnit, Count(*) As Tracking
FROM table_name
GROUP BY Customer, BusinessUnit

It would return a result set like this:

Customer Business Unit Tracking
================================================== ======
Dealer Group Binders 2
Dealer Group Office Labels 1
Forms & Supply Binders 1

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQfXcvIechKqOuFEgEQKthQCfYwqYPokUGMyUUevlpuhrrx nMjT4AoJJ7
+RNJ0kdS9Xmb7xkjNfHAS4YX
=N3w7
-----END PGP SIGNATURE-----
Kyle Friesen via AccessMonster.com wrote:
Mike,
I have databse that creates a "tracking number" based on the selections made on the form via concatenating. At the end of the tracking number, I need a two digit (01-99) sequence number by product group for each customer. Hpw do I do this without creating a table for each customer and each product group with autonumbers. For example based on the entries in this sample, the desired result would be:

Customer Business Unit Tracking
Dealer Group Binders 01
Dealer Group Office Labels 01
Forms & Supply Binders 01
Dealer Group Binders 02

It is Dealer Group's second Binder entry so 02.

Nov 13 '05 #2
If you search this group on "autonumber" you'll find a lot of advice.

Autonumber is a field type that is really a long integer, with some hidden
code
to increment the value for every added record. I do NOT recommend
any of these pseudoID forms that use combinations of initials/date/other,
as they ALL will eventually fail and most are vulnerable to user input
mistakes.
Trying to "imbed" data within an ID is almost always a bad idea.
Most good data designs have a primary key for each table,
generally an autonumber field. Most applications do not display that ID, but
use it internally for relational integrity.

That said, one of the more common solutions for what you ask, is to
concatenate
2 or more fields in the format that you require.

On your forms/reports
that need the pseudoID displayed, create an unbound textbox and set its
control source to something like:
=InStr([Dealr Group Binder],1)&InStr([Dealer Group Office Labels],1)
....etc.
-Ed

"Kyle Friesen via AccessMonster.com" <fo***@AccessMonster.com> wrote in
message news:9f******************************@AccessMonste r.com...
Mike,
I have databse that creates a "tracking number" based on the selections
made on the form via concatenating. At the end of the tracking number, I
need a two digit (01-99) sequence number by product group for each
customer. Hpw do I do this without creating a table for each customer and
each product group with autonumbers. For example based on the entries in
this sample, the desired result would be:

Customer Business Unit Tracking
Dealer Group Binders 01
Dealer Group Office Labels 01
Forms & Supply Binders 01
Dealer Group Binders 02

It is Dealer Group's second Binder entry so 02.

Please Help!

Thanks!

--
Message posted via http://www.accessmonster.com

Nov 13 '05 #3
"Kyle Friesen via AccessMonster.com" <fo***@AccessMonster.com>
wrote in
news:9f******************************@AccessMonste r.com:
Mike,
I have databse that creates a "tracking number" based on the
selections made on the form via concatenating. At the end of
the tracking number, I need a two digit (01-99) sequence
number by product group for each customer. Hpw do I do this
without creating a table for each customer and each product
group with autonumbers. For example based on the entries in
this sample, the desired result would be:

Customer Business Unit Tracking
Dealer Group Binders 01
Dealer Group Office Labels 01
Forms & Supply Binders 01
Dealer Group Binders 02

It is Dealer Group's second Binder entry so 02.

Please Help!

Thanks!


You need to do a dlookup() that returns the maximum value already
in the table that meets the conditions you set, in this case
customer and business unit, then add 1.

Your problem is that if you concatenate it to the remainder of
the tracking number, you have to jump through hoops to extract
it.

The tracking number doesn't need to be stored if your table
contains the customer and Business unit data, so just store the
tracking as an integer in your table.

Therefore the default value for a tracking number should be

nz(
Dmax("tracking","tablename",
"Customer = """ & me.txtcustomer &
""" AND [Business Unit] = """ & me.txtbusinessUnit & """"
,0)+1

put that all on one line, change tablename to the real name of
your table, me.txtcustomer to the name of the control on your
form that shows the customer name, and me.txtBU to the one that
shows business unit.

You then concatenate in the form, report or query used to see the
data.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #4

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

Similar topics

6
by: python1 | last post by:
I apologize if this is redundant. How would one fill an empty column with a sequence of numbers? The column exists in a table with aproximately 1000000 rows of data. I believe in oracle the...
4
by: CSN | last post by:
Is there a way to have p/k sequences get automatically set to max(id)+1 after COPY's like the following? copy table1 (id,name) from stdin; 1 abc 2 def 3 fhi \.
4
by: pjac | last post by:
I need assistance in creating an Automatic tracking number that appears in a textbox that looks like: 2004-001. The first part of the number is based on the year, the second part is generated from...
5
by: KD | last post by:
I am attempting to set up a data base that tracks daily production of 7 different machines. I need to track employes on machines, hours for each machine,pieces made,setups and board feet.When I get...
4
by: Kamran K | last post by:
Hello I have created a client server application using C#. Existing application is using random number on client side to generate sequence numbers that are then assigned to transactions. This...
5
by: Eric E | last post by:
Hi, I have a question about sequences. I need a field to have values with no holes in the sequence. However, the values do not need to be in order. My users will draw a number or numbers from...
2
by: raylopez99 | last post by:
Here is a short program demonstrating using IEnumberable, Linq, predicates, extension methods and some tricks and how to convert an IEnumberable sequence into an array. For future reference, not...
8
by: Slaunger | last post by:
Hi all, I am a Python novice, and I have run into a problem in a project I am working on, which boils down to identifying the patterns in a sequence of integers, for example ..... 1 6 6 1 6 6...
1
by: altaey | last post by:
Question Details: Write a program to find and print a Fibonacci sequence of numbers. The Fibonacci sequence is defined as follow: Fn = Fn-2 + Fn-1, n >= 0 F0 = 0, F1 = 1, F2 = 1 Your...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
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...

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.