Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Locking a table

Locking a table

Locking a table

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!   

RE: Locking a table

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.

There is never time to do it right but there is always time to do it over

RE: Locking a table

The id field is not "Access" 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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close