473,417 Members | 1,597 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,417 software developers and data experts.

Multi user and auto increment

Is it true that if I split my access database in backend and frontend and I
implement custom auto increment for the ID fields, that my database is ready
to be used in a multi-user environment? I found a zillion messages about
auto increment and read some of them but it's confusing. Can someone point
me to a simple custom auto increment example that I can download?
Thank you,
john
Sep 15 '06 #1
2 5479
john wrote:
Is it true that if I split my access database in backend and frontend
and I implement custom auto increment for the ID fields, that my
database is ready to be used in a multi-user environment? I found a
zillion messages about auto increment and read some of them but it's
confusing. Can someone point me to a simple custom auto increment
example that I can download? Thank you,
john
The built in AutoNumber is the most robust "auto-applied" value in a
multi-user environment. Custom-coded auto-increment solutions can work well
in multi-user environments, but only if you do it right. The two methods
that work reliably are...

********************
Store the "NextID" auto-increment value in a table. When a new record is
saved you use code to...
Grab the value from the NextID table while applying an exclusive lock on
it
Apply the value to your record and save it
Increment the value in the NextID table and save, then release the table
lock.

********************
Use DMax() + 1 in the BeforeUpdate event of the form doing insertions.
BeforeUpdate is the ONLY event that ends with the record being committed to
disk so it has the smallest window of time where two users might possibly
calculate the same NextID value. The only caveat with BeforeUpdate is that
it can fire multiple times over the life of a record so your code needs to
add a test for either NewRecord or a Null ID.

BeforeInsert has the most appropriate sounding name for doing this, but
there is an indefinite period of time between that event firing and the
record being saved. During that interval all other users will grab that
same value and you will have conflicts.

The DefaultValue property has the same issue. The value would be calculated
as soon as the New Record position of the form is painted on the screen, but
any length of time could pass before a record is actually entered and saved.
Additionally, setting the Default Value property with a DMax() + 1
expression doesn't work at all in a continuous form (even with only one
user).

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Sep 15 '06 #2
Thanks for the info, which will save me a lot of time.
john

"Rick Brandt" <ri*********@hotmail.comschreef in bericht
news:mM*****************@newssvr12.news.prodigy.co m...
john wrote:
>Is it true that if I split my access database in backend and frontend
and I implement custom auto increment for the ID fields, that my
database is ready to be used in a multi-user environment? I found a
zillion messages about auto increment and read some of them but it's
confusing. Can someone point me to a simple custom auto increment
example that I can download? Thank you,
john

The built in AutoNumber is the most robust "auto-applied" value in a
multi-user environment. Custom-coded auto-increment solutions can work
well in multi-user environments, but only if you do it right. The two
methods that work reliably are...

********************
Store the "NextID" auto-increment value in a table. When a new record is
saved you use code to...
Grab the value from the NextID table while applying an exclusive lock
on it
Apply the value to your record and save it
Increment the value in the NextID table and save, then release the
table lock.

********************
Use DMax() + 1 in the BeforeUpdate event of the form doing insertions.
BeforeUpdate is the ONLY event that ends with the record being committed
to disk so it has the smallest window of time where two users might
possibly calculate the same NextID value. The only caveat with
BeforeUpdate is that it can fire multiple times over the life of a record
so your code needs to add a test for either NewRecord or a Null ID.

BeforeInsert has the most appropriate sounding name for doing this, but
there is an indefinite period of time between that event firing and the
record being saved. During that interval all other users will grab that
same value and you will have conflicts.

The DefaultValue property has the same issue. The value would be
calculated as soon as the New Record position of the form is painted on
the screen, but any length of time could pass before a record is actually
entered and saved. Additionally, setting the Default Value property with a
DMax() + 1 expression doesn't work at all in a continuous form (even with
only one user).

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Sep 15 '06 #3

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

Similar topics

12
by: Nick | last post by:
Is it possible to have multiple auto increments in one column? Say I have two tables... 1. table 'messageboards' with fields ('id' , 'name') 2. table 'messagethreads' with fields ('id' ,...
1
by: Job Lot | last post by:
In a multi-user environment, how would I prevent users from adding Orders with identical OrderID. For instance I have following tables in my database Order ================== OrderID Identity...
2
by: Tom | last post by:
I am trying to store information into a table that has an auto increment field. There is currently no data in the table. Using the code below I cannot insert data into the table. I get an error...
6
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I...
5
by: Paulovič Michal | last post by:
hi all, I have problem with SERIAL field type (or sequence functionality). I have table with three columns - ID, IDS, NAME. I want auto-increment IDS grouped by ID. Example: 1, 1, Ferdo 1, 2,...
5
by: vul | last post by:
In VB6 there is Auto Increment check box in Project Properties, which allow you have a new version every time you compile the project. Is there any easy way to have this feature in VB 2005? Some...
9
by: abprules | last post by:
Can somehow tell me the best way for multi user development to occur in MS Access? The situation is: We are creating a new database for a small company. There are 2 of us who want to...
5
by: David Wright | last post by:
Hello Everyone I would be grateful if someone could help me with the automatic increment of a field on my subform called ‘Test_SrNo’. I am Using Microsoft Office 2000. The auto entry of the...
13
by: BobLewiston | last post by:
Using Visual C# 2008 Express and SQL Server 2008 Express, I would like to insert new records into database "AdventureWorks", table "Person.Contact". To my surprise, this table's int-value identity...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...
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,...

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.