lock a single field in ado recordset

Someone know if are possible to lock a single field in ado recordset?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
You cannot lock less then a row and very often a page (many rows) are locked.
francecapAuthor Commented:
with some expedient to code livel?
Can you tell us what you are trying to achieve?
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

francecapAuthor Commented:
I want to lock recordset field ex:
rst.fields(1) [locked]
rst.fields(2) [not locked]
the use of control binded to rst.fields(1) are not possible, like locked=true property of textbox Microsoft
the use of control binded to rst.fields(2) are possible, like locked=false property of textbox Microsoft

note that I have control non stadard Microsoft, that not has locked property!

Éric MoreauSenior .Net ConsultantCommented:
I think you are mixing 2 concepts:
1. locking control on the screen
2. locking fields in the database

1. Which control is it? Do you have the Enabled property?
2. This cannot be done on a field basis.
Here is what I would do, and it works with Access, and it should also with ADO.

Create a query for your able, and to lock certain fields make them calculated field with an alias.  Example:

SELECT EmailAddress, FromAddress & "" AS TheAddress FROM Table1

You will be able to edit the EmailAddress field but not "TheAddress" field.

Good luck.

Chris Lewis
Éric MoreauSenior .Net ConsultantCommented:
>>You will be able to edit the EmailAddress field but not "TheAddress" field.

The asker seems to want to lock it on screen. This method will only lock the database update, not the screen.
what control are you using here?

it may have other properties like "controltype" that can be used.

in any case you could put your control on top of a container like a picture box or a frame, you could disable that in code. That would have practically same effect.  you wont be able to click into control at all. only problem is if you wish to have copy to clipboard from that control.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jkaiosIT DirectorCommented:
It seems like you're using a "Page-Level" locking where two or more records are locked when a user invokes an Edit operation.
Try this method (if using an Access Database). This should eliminate the problem.

 Dim oCN As ADODB.Connection

 Set oCN = New ADODB.Connection
 oCN.Provider = "Microsoft.JET.OLEDB.4.0"
 oCN.Properties("Data Source") = "C:\Temp\MyDB.mdb"
 oCN.Properties("Jet OLEDB:Database Locking Mode") = 1      '<-- This enforces a "Record-Level" locking
 oCN.CursorLocation = adUseServer
Glad to be of assistance
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.