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

Limit Editing In Subforms 2

Status
Not open for further replies.

DevelopV

Technical User
Mar 16, 2012
113
ZA
I have a form called "frmOrder"
It contains a subform called "frmOrderProducts"

"frmOrderProducts" has a sub form called "frmOrderProductDeliverySchedule"

"frmOrder" has a boolean field called "bolPO"

If "bolPO" = True then I don't want the user to be able to edit any records in "frmOrderProducts" BUT the user must be able to edit / add / delete records in "frmOrderProductDeliverySchedule"

What is the best way to achieve this?

I tried, in "frmOrder" current event:

If "bolPO" = True then "frmOrderProducts".enabled = False

but this renders "frmOrderProductDeliverySchedule" un-editable

Thanks in advance
 
Have you tried toggling the AllowEdits property of the form?

You could use two forms, one that has the AllowEdits set to True and the other False and dynamically load the correct one based on your bolPO flag.

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
In the forms current event

Code:
dim frm as access.form
set form = me.frmOrderProductDeliverySchedule.form
'assuming that is the name of the subform control
with frm
  .allowadditions = not me.bolpo
  .allowedits = not me.bolpo
  .allowdeletions = not me.bolpo
end with

 
As usual, I appreciate/admire MajP's postings however there is one typo:

Code:
dim frm as access.form
[COLOR=#4E9A06]'set f[highlight #EF2929]o[/highlight]rm = me.frmOrderProductDeliverySchedule.form[/color]
set frm = me.frmOrderProductDeliverySchedule.form
[COLOR=#4E9A06]'assuming that is the name of the subform control[/color]
with frm
  .allowadditions = not me.bolpo
  .allowedits = not me.bolpo
  .allowdeletions = not me.bolpo
end with

Duane
Hook'D on Access
MS Access MVP
 
Thanks Duane.

DevelopV,
I can't find the AllowEdits property!
My guess you were clicking on the subform control and not the form inside the subform control.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top