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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lock only currently displayed records on a form

Status
Not open for further replies.

Anubis3000

Programmer
Dec 20, 2004
52
US
Hi,

My question is in regards to record locks. Currently I have a form and subform, with corresponding tables that have a one-to-many relationship to each other.

Because of "constraints" I want to be able to lock all records currently displayed (the record on the form, and all corresponding subform records) but not the entire record source tables.

I've tried putting this code on the gotfocus event of one of my subform fields, but it doesn't work:

Dim rs As DAO.Recordset
dim rs2 as dao.recordset

Set rs = Forms!parentform.RecordsetClone
rs.Edit

set rs2 = me.recordsetclone 'me is the subform
rs2.edit


This does not work, however, as i am still able to edit subform records. Any help will be appreciated. Thnx.
 
Thanks for your quick reply.

Unfortunately, that does not work. I am still able to edit other records on the subform.
 
yea....i tried both of these and they don't work

[Subform].Form.AllowEdits = False
me.allowedits = false

I'm thinking if i can lock up the subform's recordset, that might work, although, I don't kno how.....
 
Why are you doing this in code? Just set the property on the properties list.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top