473,770 Members | 6,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatically Generate Number On Form

I have a field on a form that I would like to automatically generate a
number, in sequential order, each time a new record is created, and be
stored in a field. The problem is that I do not want this field to be
an autonumber field because if a new record is opened by mistake and
then not used, the autonumber's field would not be in sequential order
any more. Is there a way to do this? Maybe something along the lines
of matching the actual record number that is displayed by the record
selection buttons at the bottom of the page? Any ideas on this would
be greatly appreciated. Thanks!

Nov 14 '05 #1
2 15812
I've got a free sample Access invoices database that does this on the
invoice form (frmInv) that you can download from my site and possibly
use as a starting point for your database:

www.Bullschmidt.com/Access

And the trick to making it work is this in frmInv's InvNum control's
DefaultValue property:

=Nz(DMax("[InvNum]","tblInv") )+1

Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
I have a field on a form that I would like to >automaticall y generate a
number, in sequential order, each time a new record >is created, and be
stored in a field. The problem is that I do not want >this field to be
an autonumber field because if a new record is >opened by mistake and
then not used, the autonumber's field would not be in >sequential order
any more. Is there a way to do this? Maybe >something along the lines
of matching the actual record number that is >displayed by the record
selection buttons at the bottom of the page? Any >ideas on this would
be greatly appreciated. Thanks!


Nov 14 '05 #2
Paul,

The DMax command did the trick! I appreciate it! :) Take care!
Jonathan

pa**@bullschmid t.com wrote:
I've got a free sample Access invoices database that does this on the
invoice form (frmInv) that you can download from my site and possibly
use as a starting point for your database:

www.Bullschmidt.com/Access

And the trick to making it work is this in frmInv's InvNum control's
DefaultValue property:

=Nz(DMax("[InvNum]","tblInv") )+1

Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips


Nov 16 '05 #3

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

Similar topics

5
3752
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for Office 2000. I am creating a database to track student athletes. I have created the following tables. The table title is to the far left, with fields under each. The common field will be the StudentID field, which is their student number assigned...
2
1696
by: fkealty | last post by:
I'm attempting to make a small user database more efficient. I have an employee table with id numbers, last name first name title and address. Using a combo box I select the last name and have used the following to automatically fill in values on the form: =. column(2) and so on for each field on the form This works great on the form but the only entry made on the table is the "last name", everything else appears blank.
6
1751
by: HD | last post by:
Hello. For the following, I would appreciate if anyone could tell me: if it can be done, how it might done, and/or what search terms I could use to find the solution myself. I would like to create a database in which _adding a new record automatically creates a new field in the table_ (ideally, deleting a record would also delete the field that was created when that record was added). Thus, the number of fields in the table would...
1
2124
by: Frankie | last post by:
Hi, In my form users must enter data about new employees. One of the fields is the birthdate of an employee. The next field is a registration number that looks like this: 0YYMMDD. 0: first digit that is always a zero unless the registration number already has been stored, in this case the first digit will be a 1, etc. YY: year of birth (without century)
11
2558
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....
9
5181
by: Nooby | last post by:
New to Access here. I inherited a db that has the first column as an automatically generated sequential number. I want to bump it up, but for the life of me I can't figure out how to do it. Is this type of generation a built in function of Access? I'm sure it can be written manually, but I doubt someone took the trouble to do it... Can someone point me in the right direction to figure out how to change this number? Thank you one and all!...
14
12450
by: dan | last post by:
I would like to have the preprocessor automatically generate the number of array elements requested. Each element is zero. The elements get pasted into a larger array. The other elements may be non-zero. ***** Here is an example of what I need to do: #define YEAR_1 2005 #define YEAR_2 2007 #define YEARS (YEAR_2 - YEAR_1 + 1)
1
1960
by: DanielLauJJ | last post by:
When inserting a record into a table, I want SQL Server to generate a number automatically for the Primary Key. (e.g. OrderID is 1, 2, 3 and so on) How to do it? (This behavior is similar to the "Auto-number" in Microsoft Access) http://raymondlamsk.blogspot.com/2008/03/faq-ms-sql-server-how-to-generate_24.html
6
2655
by: GLEberts | last post by:
Novice looking for some direction!! I am trying to have a text box autopopulate with a number added to it at the end and I am having a difficult time doing this. Example: (1) I have a combo box I would like to have a purchase order number automatically generated from that number to another text box What I would like to have have happen is when I click on the combo box and choose the selection from the combo box to have the new...
0
9592
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
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10231
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
10005
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,...
1
7416
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
5313
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...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
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
2
3576
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.