"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.