Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Multiuser / Networking / June 2006

Tip: Looking for answers? Try searching our database.

How to get unique next number from table field?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MilanB - 28 Jun 2006 21:27 GMT
Hello,

Multiusers use access database. I need to get next field number (ID), and
must avoid using AutoNumber.

How to get next value (DMAX or something), but to protect users, from
getting same next value? Any trick, or I have to design MultiTier application?

Thanks
Milan
Nikos Yannacopoulos - 29 Jun 2006 07:16 GMT
Milan,

One way to do it is to use an unbound form for data entry, and some
simple VBA code to write the record to the table at the click of a
button (Save); you can use either a recordset operation or an append
query to save the new record, and look up the last used PK value (DMax)
right before the record save. This all happens so fast that the chances
of two new records colliding (two users clicking the button on the same
split second) are next to nothing.

HTH,
Nikos
MilanB - 29 Jun 2006 10:28 GMT
Oh, I forgot to tell, that I use Access DB from Visual Studio C#.

Thanks
MIlan

> Milan,
>
[quoted text clipped - 8 lines]
> HTH,
> Nikos
Larry Linson - 30 Jun 2006 03:29 GMT
> Oh, I forgot to tell, that I use Access DB from Visual Studio C#.

Nikos' advice is still appropriate, providing you are writing the record
from code, not from somewhere that is obscured by various wizards. This, by
the way, is not a good source for ADO.NET information; it is for "multiuser"
applications as defined in the Access world... user interface in Access,
shared Jet backend.

Larry Linson
Microsoft Access MVP
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.