Need form and subforms to not AllowEdits on open

J

jacecrocker

I have a form with subform /subsubform on one tab and a subform on
another tab control that has a toggle button when on opened they are
not to be modified. You can then press the button to edit. The code I
have now only does this for the main form. I need to be able to add
the subforms to this code. I am not sure how to make this happen.
Pretty new at this stuff. Below is my code that I am using below. I
have tried several things to no avail. Any help would be greatly
appreciated.

Jace

Function ToggleEdit(frm As Form, BEdit As Boolean)
On Error GoTo err_ToggleEdit

'toggle edit and backcolor
If BEdit Then
'Set the focus to the control holding the subform
'Forms!Orders!subControlOrderDetails.SetFocus
With frm
.AllowAdditions = True
.AllowDeletions = True
.AllowEdits = True
.Detail.BackColor = CTeal
End With
Else
With frm
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
.Detail.BackColor = CGrey
End With
End If

exit_ToggleEdit:
Exit Function

err_ToggleEdit:
MsgBox "Err Number " & Str(Err) & ": " & Err.Description
Resume exit_ToggleEdit

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top