Auto number with data information

T

tom

Anyone can help to combine data into auto number below:

data1 data2 date3
AAA BBB 01/OCT/09

Normally auto number will only create by system as:
1.2.3.4.5.6.7.8.................

refer to the above, possible to combine data1...3 into auto number as below:
AAA-BBB-091001-01 / AAA-BBB-CCC-901001-02 ............

Thanks You
Tom
 
S

Stefan Hoffmann

hi Tom,
Anyone can help to combine data into auto number below:
data1 data2 date3
AAA BBB 01/OCT/09
Normally auto number will only create by system as:
1.2.3.4.5.6.7.8.................

refer to the above, possible to combine data1...3 into auto number as below:
AAA-BBB-091001-01 / AAA-BBB-CCC-901001-02 ............
You need an auto number field in your table, then create a select query
with SQL statement like this:

SELECT [data1] + "-" + [data2] + "-" +
Format([date3], "yymmdd") + "-" + [identityField]
FROM [yourTable]




mfG
--> stefan <--
 
J

John W. Vinson

Anyone can help to combine data into auto number below:

data1 data2 date3
AAA BBB 01/OCT/09

Normally auto number will only create by system as:
1.2.3.4.5.6.7.8.................

refer to the above, possible to combine data1...3 into auto number as below:
AAA-BBB-091001-01 / AAA-BBB-CCC-901001-02 ............

Thanks You
Tom

Don't confuse data DISPLAY with data STORAGE. They're different!

It's neither necessary nor appropriate to create a new field containing data
that's already stored in another field, in your table. It just wastes space
and makes the database harder to manage.

Instead, store the three or four fields and concatenate them for display
purposes, either in a calculated field in a Query or in the control source of
a form or report textbox. For the query, create a query based on your table
and type

BigName: [Data1] & "-" & [Data2] & "-" & Format([Date3], "yymmdd") & "-" &
[ANUM]

all on one line in a vacant Field cell, where ANUM is your "autonumber" (see
next paragraph).

In addition, an autonumber is not appropriate here. Autonumbers are
meaningless sequential numbers; they get big (*at least* as big as the total
number of records in the table, often much bigger); they will have gaps in the
numbering; they can even become random, with -1813225416 followed by 320941639
and so on. Your proposed format would limit you to a total of 99 records in
your database... which you might consider a bit restrictive. Think about what
you want this number to mean (a sequential count of records for a date? for a
given combination of the three fields? or what?) and maintain it
programmatically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top