Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Locking On Unbound Forms

Status
Not open for further replies.

mdav2

Programmer
Aug 22, 2000
363
GB
I use unbound forms and VBA to control the data entry and editing on forms. I do this to provide more control to the program to perform validation checking and avoid the problems with the bounds fields being immediately updated.

I would like to be able to lock a record on a table whilst the user is editing it but can't work out how to do this. I usually create a recordset of all the reocrds in a table then use the FINDFIRST method to get to the record I want. Then issue the edit and update when the user clicks the save button.

However this is not good for multi user systems because two people can edit the same record and overwrite the others details. Is it possible to assign a lock on a TABLE record after the edit property is set for the recordset?

eg.

with rstRecordset
.Edit
' code here to lock table record
end with

Conversly when the data has been updated similar code would need to take the lock off the table.

This may require me to change the way I write systems but it would be nice to know if it is possible.
 
not sure if this is the feedback you were lookihng for but here is my 2 cents worth.
This is from Access Help file:
"When working with Microsoft Jet-connected ODBC databases and large dynaset-type Recordset objects, you might discover that using the Find methods or using the Sort or Filter property is slow. To improve performance, use SQL queries with customized ORDER BY or WHERE clauses, parameter queries, or QueryDef objects that retrieve specific indexed records."

You can then use the LockEdits property to lock the recordset being edited
 
if locking a recordset, it locks the recordset that is unique to the user that created it. I need to select the record on the table and apply the lock to the table not the recordset.

I think the code would need to find the same record in the table and test for a record lock on the table.

If anyone can solve this little riddle then I would be most appreciative.

Many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top