473,322 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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

12
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

✓ answered by Rabbit

That's odd. Try 2,1,2

21 2921
jimatqsi
1,271 Expert 1GB
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
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 Expert Mod 8TB
Why have a temp table where they edit the record separately from the original?
Jul 22 '15 #4
Taken
12
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
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
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 Expert 1GB
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
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 Expert Mod 8TB
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
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 Expert Mod 8TB
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
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
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 Expert Mod 8TB
The recordset options will block everyone except the recordset.
Jul 28 '15 #15
Taken
12
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 Expert Mod 8TB
That's odd. Try 2,1,2
Jul 28 '15 #17
Taken
12
That's it Robbit thank U so mutch,
Jul 29 '15 #18
Rabbit
12,516 Expert Mod 8TB
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
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 Expert Mod 8TB
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
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
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
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
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
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
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
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
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
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
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
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.