473,785 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create autonumber

May anyone can teach me to assign a autonumber, I want to create a
number that is starting with year (auto change to year 2006) +
autonumber (eg. 2005-1001, 2005-1002 and so on)
Nov 13 '05 #1
2 2863
Rog
It is not a good idea to use an autonumber for anything else than a
record key behind the scenes, invisible to the user. If you want
numbers like the ones you describe you should use a counter and add 1
for every new record.

Nov 13 '05 #2

Apple wrote:
May anyone can teach me to assign a autonumber, I want to create a
number that is starting with year (auto change to year 2006) +
autonumber (eg. 2005-1001, 2005-1002 and so on)


Apple,

As Rog so eloquently said, to not use the Access autonumber system.
While I have never had any problems with it, I continue to read from
well informed developers to not use it. Better to use a unique table
to store your record numbers in. If you wish to creat a number with
the year, you can steal the clock date and place it into a memory
variable. Then read the top number from your unique number table.
Place that value into another variable. The third variable will
combine the values from the first two in the format you wish. I built
one in 1999 that reads the clock date, format out the last two digits
of the year, read the top number of the record table, marry the two
values and display it in text box that is not allowed to be modified by
the user. This way the number values continue correctly. Then the
form into which they input the record into the datebase is modal and
the only way out is to click on the OK or the Cancel button. If the
Cancel button is used, the number is not stored anywhere. The number
is stored only when the OK button is clicked and certain fields are
dirty. You can do what you want here. I hope this is some help for
you to get started either producing or ask more questions.

FlSteve

Nov 13 '05 #3

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

Similar topics

1
3362
by: poohnie08 | last post by:
i have a excel spreadsheet showing staff name, date,work hour, ot hour, slot1, slot2, slot3, slot4 and others). The "()" will keep repeating from day 1 until end of month. eg in excel spreadsheet, ============================================================================== A1 |A2 A3 A4 A5 A6 A7 A8 |A9 A10 A11 | 01/02/04 |02/02/04 StaffName |Work Hr OT Hr Slot1...
3
51270
by: Gekko . via AccessMonster.com | last post by:
I want to create a query that the first field should be an autonumber. For example I want the name and last name from the Emp table, but I want that the first field is an autonumber that identifies the record so the results of the query should look something like Field1 Name LastName 1 Gekko NoLast 2 Mary Jane 3 Jon Doe ***************************************** * This message was posted via...
24
3123
by: flkeyman | last post by:
Work in legal office. Trying to create solid designed database structure. This is list of tables w/fields and primary keys. Any comments/advice greatly appreciated. tbl-Defendants CaseNumber (primary key) FirstName MiddleName LastName
5
3058
by: Apple | last post by:
May anyone can teach me how to assign a autonumber, I want to create a number that is starting with year(auto change to year 2006) + autonumber (eg. 2005-0001, 2005-0002)
2
1987
by: Apple | last post by:
Is there anyone can help me to solve this problem? Thank!
4
7749
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query, but I can't update record in query or in form. I believe the problem is due to the source query. In source query, there is a filter to show the incomplete record ("is null" in delivery date)], but I need to re-use the job no. if the job is...
9
60103
by: minjie | last post by:
I need to upgrade a MS Access database (Version 2002) with a script only, i.e., via SQL statement, not via Access GUI, and I'm having trouble defining an AutoNumber field. I got an exception error when running the follwoing (in a C++ program using ADO): ...... cmdStr = "CREATE TABLE mytab " "( AutoNumber, " " TEXT(50), " "CONSTRAINT PRIMARY KEY ()); ";
1
1676
by: junis | last post by:
Dear Experts.. i need create table with identiry field .. if i use GUI ..i just click and choose autonumber as type ... but i try with SQL Stement : "Create Table Test (id autonumber, Desc Text(50))" i get error message that syntax error in filed definition.. i try again .. i change "autonumber" with "identiry" and.. i get error message again..
1
2791
by: sanju4kk | last post by:
I am attempting to create a module that I can call to create a new field in my temp table that will be an autonumber, and then assigned that new field as the primary key. I have been search high and low for the code, it seems like an easy task but haven't solved the problem yet. Here is the current scenario: I import an text file of numbers, once imported, I need to assign a unique (autonumber) value to each number imported, starting with 1...
0
9647
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10356
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10098
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9958
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8986
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7506
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6743
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4058
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
3
2890
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.