Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking a table

Status
Not open for further replies.

imstuck

MIS
Sep 27, 2000
18
US
I have a table that holds a value (lastidtab)--one record. In my program I have a command button assign the next id number by getting the value in the lastidtab and adding 1. It then updates the the lastidtab with the incremented number. And so on.

The problem I am having is that the user will often have the Access database open more than once on her desktop and it appears that the lastidtab is not being updated properly, because at a later time, when the user needs to assign another id number and then tries to save the data to the table with that id number, she gets a message that says the changes you requested to the table were not successful because it would cause duplicate values in the primary key etc. The ID field is the primary key. The Access database is on our network.

Is there a way either make sure a user can not open the Access database twice or somehow deal with the table not being updated properly?

Thank you! [sig][/sig]
 
See Why AutoNumber shouldn't be used in MultiUser databases (And How to ge the Unique Number) in the FAQ under this topic.


Note the dbdenyread on the unique value table.

[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
The id field is not &quot;Access&quot; autonumbered--not the Autonumber data type. My program increments it.

I thought locking the table would work, but it just locks someone out while accessing it which is not the problem. It's not two different users that's the problem, it's the same user having Access open twice and possibly flipping between the two open programs. The table is not updated in each open program.

Does your FAQ apply to that situation? Thanks

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top