473,396 Members | 1,975 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.

How to view the YEAR in Auto Number Data type?

Hi All,

I have a table that use an Auto Number (Data type) as my primary key. I want my field to be look like this.

WJ-2012-00001 ---> first entry.

"WJ" , "-" and "2012" ---> are all constant.

The last Five Digit is the Auto Number.

Please help me to solve my problem.
Jan 12 '12 #1
3 1609
Mariostg
332 100+
IF "WJ" , "-" and "2012" ---> are all constant, then what is the point of even considering storing this and waste space? Will 2012 at one point be 2013?

Is WJ and 2012 recorded is some other field?

If that is really what you want, you can specify the format in the table design for the given field.
Jan 12 '12 #2
NeoPa
32,556 Expert Mod 16PB
Mario is right. You need to ask your question properly, making it clear, before we can provide an answer that matches your question. Anything offered at this point is in danger of being on the wrong lines as we can't know what they are until you tell us. What is WJ? And what is 2012? Please explain clearly.
Jan 12 '12 #3
C CSR
144 100+
This is a "composite" key. The autonumber increments, the other 1 or 2 parts of the key are constant. To put it all in one field you can't use strings (they don't increment too well). You can put the info into 2 or three fields and create a composite key, setting the default value to WJ- and 2012- and then keeping your autonumber field free to increment. You would still have to deal with the extra zeros.

I understand why you want something like this to handle unknown future conditions. I'd use three fields, like what was said, for changing the constant values (based on year change or what-not). All of this looks like a progamming issue on the input with some concatenation going on, and some math; but I know once that is coded, you can make the properties of all three fields set to primary "composite" key, so that they react together with other queries. Also, you can designate a field as "primary" without using autonumber--you'd just have to be prepared to trap the error on input for dups. Hope this helps...
Jan 15 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Geoff Biggs | last post by:
Evening all, I'm trying to add a new built-in number data type to Python with its own syntax, so I'm working directly with the interpreter rather than creating my own extension module (side...
2
by: WjWm | last post by:
Hello all, I'm kind of struggling with numeric data types... I have read alot of material, and think I have a 'decent' grasp on the various number data types and the effects of the scale and...
2
by: Mike N. | last post by:
Hello- I have a database that uses an auto number field type that goes out of sync periodically. My customer gets a "cannot add record, number already in use" error message. I dump the records...
5
by: dananrg | last post by:
I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g: import dbi, odbc ....and it seems to meet my needs. I'd rather use a module that comes...
2
by: Eric | last post by:
Why it gives that error. Both tables have same type of number Data type mismatch qry = "SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology WHERE...
3
bhcob1
by: bhcob1 | last post by:
I have a list which is populated with Fields from a table, I want to be able to determine if the data type of the value selected in the list is Number. Any ideas, i thought there would be something...
4
by: kcddoorman | last post by:
I'm trying to make a multi criteria server filter and everything works fine when filtering for strings. When I add a number field to the filterable set I run into problems. Here is the VBScript I'm...
5
by: Amit Parmar | last post by:
Hi Everybody, I am fetching number data from a table. i want to add '$' sign to this data. I already tried "TO_CHAR" function. This works fine but it converts number data type to string data...
1
by: foxygrandma | last post by:
I am having data type problems. The first thing I had to do was convert the weight of one column from kg to lb. I did this by multiplying by 2.20462262 and updating a new column, however, the...
2
by: JoeKid09 | last post by:
Hi Guys, I'm working on converting a large table with a field that has numeric values in text data type. When I do the conversion in Access automatically some records don't get converted. The...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.