Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

.mdb  lock unlock problem.

Posted on 2011-02-12
7
Medium Priority
?
838 Views
Last Modified: 2012-05-11
I have a multi user Delphi-Access application.
I am looking for a real simple code that i can make sure 2 people are not working on the same row at the same time.

I been reading about lock and unlock .
Is there a simple way just to make sure 2 people are not editing the same row at the same time.
0
Comment
Question by:Grant1842
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 1200 total points
ID: 34880975

Thats really a function for the database to perform.
However if you want some kind of control, you can add a field to your tables that indicate that a record is currently in edit mode
You can make it a timestamp. If the record is opened, you insert the current time to that field. When the second user tries to open the same record, they receive a notification that the record is currently being edited and they can only view.

When the record is saved, set the timestamp field to null.
Using the timestamp, you can determine how long a record has been opened and if it is still valid, eg you don't expect someone to keep a record open for several hours
0
 
LVL 14

Expert Comment

by:systan
ID: 34881355
ewangoya?,
congratulation, your on the Delphi Hall of fame, overall.
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 34881383

Thanks Systan
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 24

Assisted Solution

by:jimyX
jimyX earned 400 total points
ID: 34881402
There are 3 types of records locking, you may read this article for more info:
http://www.databasedev.co.uk/multi-user-application-record-locking.html

The option you are after is:

In the MS Access go to:
Tools -> Options -> Advanced tab -> "Default record locking" check "Edited record".
0
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 400 total points
ID: 34885972
If you are using ADOConnection, this might be an option for you...

Achieve Record locking in Delphi 5-6 with Access 2000
http://www.delphi3000.com/articles/article_2538.asp?SK=
0
 
LVL 46

Expert Comment

by:aikimark
ID: 34893706
What versions of Delphi and Access are you using?

How are your multiple users editing records? (configuration and UI)

It is possible to use pessimistic locking, but you pay a performance penalty.

Your code is supposed to receive (trap) an error when you try to change a row that has been changed by someone else.  Is this not happening?
0
 
LVL 12

Author Comment

by:Grant1842
ID: 34902347
Thanks for all your comments. I will try and sort through them.

I am using D2010 and access 2007.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question