473,405 Members | 2,334 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,405 software developers and data experts.

Sequential numbering

how can I set a form so that when i open it , it appears with the next
sequential number. I want to set the number pattern and not use
autonumber
Nov 12 '05 #1
4 2931
Cliff,

Say you have a TblCustomer table with a CustomerNum field. You have a
FrmCustomer based on TblCustomer and the form has a textbox bound to the
CustomerNum field. Put this expression in the Default Value property(Data tab)
of the textbox:
DMax("[CustomerNum]","TblCustomer")+1

When you enter something in any field in the form and save the record,
CustomerNum will automatically have the next sequential number.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"cliff williams" <cw*******@multipak.com> wrote in message
news:78**************************@posting.google.c om...
how can I set a form so that when i open it , it appears with the next
sequential number. I want to set the number pattern and not use
autonumber

Nov 12 '05 #2
On Thu, 11 Dec 2003 20:57:45 GMT, "PC Datasheet" <sp**@nospam.com>
wrote:
Cliff,

Say you have a TblCustomer table with a CustomerNum field. You have a
FrmCustomer based on TblCustomer and the form has a textbox bound to the
CustomerNum field. Put this expression in the Default Value property(Data tab)
of the textbox:
DMax("[CustomerNum]","TblCustomer")+1

When you enter something in any field in the form and save the record,
CustomerNum will automatically have the next sequential number.


If this is a multi-user environment (or could become one) it is better
to apply the sequence in the Before Insert event.

More than one user could be adding a record with the same CustomerNum.
Besides, the id has no relevance until a record is created.

- Jim
Nov 12 '05 #3
I assume the form is linked to a table or is adding data to a table . .

so if the table is called tbl_INFO with a key of INFO_KEY (long number )
then you can get the next key number with

NextNumber = Dmax("[INFO_KEY]","tbl_INFO") + 1

I use this all the time even if the key is set to autonumber . . as it gives
the key to the new record for use elsewhere in any required code.

hope this helps
cheers
paul g

"cliff williams" <cw*******@multipak.com> wrote in message
news:78**************************@posting.google.c om...
how can I set a form so that when i open it , it appears with the next
sequential number. I want to set the number pattern and not use
autonumber

Nov 12 '05 #4
The DMax domain aggregate function can be used to get the highest value in a
field in a table, and you can increment that to create the next one. Of
course, you want to be sure you do this only for new records... a little
slipup and you might overwrite existing key fields.

Larry Linson
Microsoft Access MVP
"cliff williams" <cw*******@multipak.com> wrote in message
news:78**************************@posting.google.c om...
how can I set a form so that when i open it , it appears with the next
sequential number. I want to set the number pattern and not use
autonumber

Nov 12 '05 #5

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

Similar topics

0
by: Robert Kilroy | last post by:
Greetings, I've been working on a project for my church for a couple of weeks. We're going to be selling tickets to our events and we need to look for available seats in our hall. I have a...
0
by: Lynn | last post by:
I have a query which shows start date and the last 4 digits of a person's SSN. I need sequential numbering of an assending start date yet desending last 4 digits of SSN (L4SSN). Using: RowNum:...
1
by: systems analyst | last post by:
This is my modification on an original solution posted by Trevor Best (trevor@microprism.com) back in 1996. Insert the following code in a Module in your Access data base. Option Compare...
4
by: James | last post by:
Hello there, Does anyone know how to create a sequential record number field in a query?? Thanks, James
14
by: amywolfie | last post by:
Hi All: I know this is simple, but I just can't seem to get there: I need to sort a table by a text field (txtDescription), then assign sequential numbers to the field SEQUENCE in table. ...
1
by: S. van Beek | last post by:
Dear reader, Is there a function to use in a query for numbering the records starting with one (1) and then second (2) and so on? Thanks for any help
0
by: palmorek | last post by:
I am trying to build a macro in Excel for the purpose of authorizing checks. I am trying to figure out when the user is done entering their information they hit an enter button and the macro will...
19
by: eric.nave | last post by:
this is a slight change to a fequently asked question around here. I have a table which contains a "sortorder" column where a user can specify some arbitrary order for records to be displayed in. ...
1
by: wbw | last post by:
I have a database of products in which I have determined when the product sold. The table has two fields ITEM and SOLD. Each product’s first selling date may be different and may not have sold in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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,...

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.