Subform Locking

  • Thread starter Thread starter Chucklinn
  • Start date Start date
C

Chucklinn

Guest
I am using a tabed form. it is set to prevent data entry unless you click on a edit button. the problem I am having is that several of the tabs have subforms on them. when I allow edits on the first page then the other sub forms do not allow edits with out putting edit control on each one of hte sub forms. Is there any way to unlock all forms at once.
 
dim ctl as control

for each ctl in me.controls
if ctl.controltype=acsubform then
ctl.allowedits=true
end if
next ctl

This finds all subform controls on the main form, so the procedure needs to be associated with a command button on the main form.
 
I tried you code but I am getting the same error that I get when ever I try to use the allowedits keyword that the object doesn't suport this property or method.
 
her is the code afer your code.
Private Sub EditRecord_Click()
Dim ctl As Control
Me.AllowEdits = True ' this opens the forms edit property


For Each ctl In Me.Controls
If ctl.ControlType = acSubform Then
ctl.AllowEdits = True ' this is where I get the error
End If
Next ctl


[This message has been edited by Chucklinn (edited 06-01-2001).]
 
I realize this post is from some time ago - but I was having the same problem and found this resolve:

Private Sub CmdAllowEdit_Click()

Me.AllowEdits = True

Dim ctl As Control

For Each ctl In Me.Controls
If ctl.ControlType = acSubform Then
ctl.Form.AllowAdditions = True
ctl.Form.AllowDeletions = True
ctl.Form.AllowEdits = True
End If
Next ctl

End Sub

Hope this helps anyone struggling as I was!
Emillard
 
Emillard

Thank you for having the foresight to post a solution, regardless of the original thread's age!

I was faced with the very same problem and struggled to find the right "key" to open up my subforms for editing. Many thanks!
 

Users who are viewing this thread

Back
Top Bottom