473,748 Members | 8,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generating Numbers automatically

I'm using Access 2002.
I have a field called Job No.
It is a text (data type). The reason being that there is an "I" in front of
each number i.e. I1234 I1235 etc
The problem is that when the user enters a new record, he/she has to know
what the last recorded job no. is present in the database, in order to then
assign the next sequential job no. So its a manual process.
I don't want to seperate the "I" component from the Job No. field in order
the make the field an autonumber datatype.
Is there some code I could use to allow the system to somehow automatically
assign the next sequential number incorporating the prefix "I" to each
number ?
thank you for any help.
Nov 13 '05
11 2552
On Sat, 16 Jul 2005 23:04:20 +1000, "Gary" <g4****@hotmail .com> wrote:
Thanks for the advice. I think I will simply go with the number and remove
the "I" as you suggested.
I actually added +1 to that formula - eg: DMax("FieldName ", "TableName" )+1
to give me the next sequential number.


if you follow this route you might just as well use autonumber rather
than DMax. I think this is what Rick was suggesting. The autonumber
route is more reliable if several users can add records at the same
time.

The two methods behave differently if records with the highest numbers
are removed - DMax will reuse the numbers whereas Autonumber will only
do this if the database is compacted before any more records are
added.

Nov 13 '05 #11
But how do we do compact programatically ?

Nov 13 '05 #12

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

Similar topics

2
6373
by: Jack Higgs | last post by:
I'm building a maths program for year 6 children. Problem with division - I generate a random number between say 1 and 1000. I want to generate another random number which when divided by the first number gives a whole number answer. Any Idea how I could do this? Obviously generating prime numbers is a bit of a problem as well! Cheers, Jack
7
2709
by: Steve Jorgensen | last post by:
Here is some code to generate code for raising and getting information about custom errors in an application. Executing the GenerateXyzErrDefs procedure generates the code. <tblXyzError> ErrorCodeOffset (Long Int) ErrorObjBaseName (Text(50)) ErrorDescription (Text(255)) 1 DontDoThat Hey! Don't do that!
0
341
by: Gary | last post by:
I'm using Access 2002. I have a field called Job No. It is a text (data type). The reason being that there is an "I" in front of each number i.e. I1234 I1235 etc The problem is that when the user enters a new record, he/she has to know what the last recorded job no. is present in the database, in order to then assign the next sequential job no. So its a manual process. I don't want to seperate the "I" component from the Job No....
14
9894
by: Anthony Liu | last post by:
I am at my wit's end. I want to generate a certain number of random numbers. This is easy, I can repeatedly do uniform(0, 1) for example. But, I want the random numbers just generated sum up to 1 . I am not sure how to do this. Any idea? Thanks.
8
25473
by: kiranchahar | last post by:
Hey all, How do I generate random numbers with Uniform distribution Uniform(a,b) using C-programming? I want to generate uniform random numbers which have mean following Uniform(p,q) and also variance as Uniform(s,t)? any suggestion would be really appreciated. Thanks, Kay
1
1577
by: sparks | last post by:
we are generating numbers for the data collection people. this worked fine for a while.. Private Sub generatenumber() Dim db As DAO.Database Dim rs As DAO.Recordset Dim StudentNumber As Integer Dim gennum As Integer Dim finalnum As Integer
26
7913
by: bilgekhan | last post by:
What is the correct method for generating 2 independent random numbers? They will be compared whether they are equal. What about this method: srand(time(0)); int r1 = rand(); srand(rand()); int r2 = rand(); bool f = r1 == r2;
3
1298
by: mphil.star | last post by:
I am creating a certain program and in that program i want to add a field which will be creating numbers with text in sequence older " Like MPL 001/08 to unlimited " And 08 be current year. This will only be possible if that field is enebled, if the condition of enebling this field still is false then the field returns the previous value that is it maintances the previous record number. please assist as soon as possible
0
9537
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...
0
9367
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9319
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
9243
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
8241
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
6795
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
6073
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();...
0
4599
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.