473,480 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to lock a record from table I want not lock a record from a form

12 New Member
hello every body
i have a question, I need to lock one ligne in a tabel, is it possible for Access 2010 ?
thank's for your response
Jul 22 '15 #1
21 2932
jimatqsi
1,271 Recognized Expert Top Contributor
Taken,
Welcome to Bytes. You'll find a large number of eager helpers here, but you'll have to do your part to present a good explanation of what you want. Please expand on what you said, because it is not very clear what purpose you are trying to accomplish.

Is this a permanent "lock" or during some brief period? If so, what is that period defined by?

Jim
Jul 22 '15 #2
Taken
12 New Member
thank's jimatqsi
I work for an application Access VBA 2010 the application have back end and front end, 5 users the problème is:
I have two tables original and Bis, the Original table contains one line Identity and the Questions and there Responses.
the tabel Bis Contains a temporary line (they will be delete after click on bouton) the questions and Responses, to permit for a users to edit data and write Responses.
I want When I click on button to save edit, the line identity from tabel Original will be locked
thank U fore your help
Jul 22 '15 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Why have a temp table where they edit the record separately from the original?
Jul 22 '15 #4
Taken
12 New Member
hello Robbit thanks for your response
the temp table is local for each user, it permit to not get the dirty data in the original table. all records will be delete from the temp table for each edit
Jul 23 '15 #5
Asmat
1 New Member
By This Section
You need to make another form, that is lock
and only few row or field can be for General Users

Like
User Id _______
Search by Name _______
Date
Jul 23 '15 #6
Taken
12 New Member
Thank you Asmat for your response
I want just to know how can I lock one record from table on vba access.
I tries
Set rstQR = New ADODB.Recordset
Set conn = New ADODB.Connection
Set conn = CurrentProject.Connection
rstQR.Open "SELECT tableName.ID, tableName.NbrQuestion FROM tableName " _
& "WHERE (((ID)=" & Me.ID & ") AND " _
& "((NbrQuestion)=" & Me.NbrQuestion & "))", conn, adOpenUnspecified, adLockPessimistic, adCmdText

it work but dont lock the record showed on SQL statment
Jul 23 '15 #7
jforbes
1,107 Recognized Expert Top Contributor
You can't lock a record for edit in Access except for a temporary lock while a SQL process is taking place. Once the SQL process is completed, the lock is released. It's not intended to last more that a second or two.

Usually, in the scenario you are describing, a flag or status field is added to the Table to put a "Soft Lock" on the Record. Then code is added to the Forms to either set and reset the Allow Edits and Allow Deletions properties of the Form or enable or disable buttons that launch the Editable Forms.
Jul 23 '15 #8
Taken
12 New Member
Yes jforbes that's what I need ! à temporary lock but juste for one record from tabel (back end) not from form (front end).
but I don't know if it's possible ??
if it is possible I don't have any Idea for how can I do it.
I know how to lock tabel but not just a record from that table
best regard
Jul 23 '15 #9
Rabbit
12,516 Recognized Expert Moderator MVP
You can't "hard" lock a table or row in Access. You will have to use a more robust database backend if you want to do that.

You can only code your own "soft" lock that the user can get around by opening the table directly.
Jul 23 '15 #10
Taken
12 New Member
Thank's Robbit
My problem is How to specifate one record from table to lock it ?
I want to lock juste the record specified not all the table
Jul 24 '15 #11
Rabbit
12,516 Recognized Expert Moderator MVP
Add a field to the table that says whether or it it's locked. You set it when you want to lock or unlock it.
Jul 24 '15 #12
Taken
12 New Member
Thank U Rabbit for your response. sorry for my absence.
I want to know what kind of Number permit me to lock one record
in set recordset=currentdb.openrecordset("Select...", Type, Option, Lockedit)
Exemple: 2, 512,2)
best regard
Jul 28 '15 #13
Taken
12 New Member
Hello every body
I get the solution
(2, 2, 3)
but the problem is that the first user is blocked :'(
I want to lock for the second user
Jul 28 '15 #14
Rabbit
12,516 Recognized Expert Moderator MVP
The recordset options will block everyone except the recordset.
Jul 28 '15 #15
Taken
12 New Member
my probem is when I test with two form, with loop an doevents for each user, on click on button, the edit of the first user (first click on button) will not be saved. the edit of the second user will be saved
Jul 28 '15 #16
Rabbit
12,516 Recognized Expert Moderator MVP
That's odd. Try 2,1,2
Jul 28 '15 #17
Taken
12 New Member
That's it Robbit thank U so mutch,
Jul 29 '15 #18
Rabbit
12,516 Recognized Expert Moderator MVP
No problem, but you should be aware that the lock lasts only as long as the object. It won't keep the lock if the user wants to come back to the record later to finish up.
Jul 29 '15 #19
Taken
12 New Member
Another Problem
2, 1, 2 lock all the table, my aime was to lock one record
2, 2, 3 lock one record but if two users clic for the same record
the edit of the first user will be ignorent
Jul 30 '15 #20
Rabbit
12,516 Recognized Expert Moderator MVP
At this point, I don't know which combination is going to work, you could try all the possible combinations until you find the one that does.
Jul 30 '15 #21
Taken
12 New Member
Ok thank you Rabbit, when I find the solution I'll post it
Jul 31 '15 #22

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2512
by: Tom Cusick | last post by:
We have a Job Shop database. When I get an order in I put all the line item information into the database. Some orders have multiple lines and most of the information is the same. (eg. Customer...
0
1390
by: ethanj /personal/ | last post by:
I have main form with subform, similar to the Order Details form in the Northwind database. The the main form record locking is released when I click to edit subform's records. Is there away to...
1
3272
by: Themis Parintas ste kardias | last post by:
How can i make a form which is lock and display only the 3th record of a table
4
40960
by: deko | last post by:
I'm trying to import an Excel Spreadsheet into an Access Table but sometimes things get buttered up if the spreadsheet does not have the right columns. So I want to drop the Access table and...
2
1358
by: carrionk | last post by:
Hi, I need to compare if certain records are contained whithin a Master Table. The following tables illustrates the comparing tables and the required Result Master Table ============...
3
10305
by: equalive | last post by:
Hi guys, I'm having problem locking a table in Ms Access using VB6 code. Actually I have 3 tables. Assume table names is A, B, C. Following is the process. 1. Open table A and update table...
2
15756
by: adri4n | last post by:
as wat ive mentioned in the title.. im would like to know whether the a particular record/table is being locked in my program. some of the methods which i would like to develop are as below: ...
8
2599
by: nytimescnn | last post by:
I've read some discuession about lock() for thread-safe. I am wondering what will be the differce between below two code segment? Code 1: class A { private static Object padlock = new...
3
2519
by: HDI | last post by:
Hi, I'm writing a windows application where users can update records but how can I lock a record when a user opens it. With ado and vb6 you can lock the opened record but with ado.net I...
1
2443
by: stuart | last post by:
I have a list of records in a subform that a user can either edit or delete. This is an unbound form. If the user deletes a record, I want to refresh the form, and then position the cursor on the...
0
7080
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...
1
6735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6895
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
5326
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,...
1
4770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2992
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.