From a form, I am opening a form that has two subforms and one of the subforms also has a subform. I don't want any of the forms to be editable. I am opening the form with:
I can edit the form.
I have tried the following code on both the Form_load and Form_Open events of the form being opened:
The form is STILL editable. The only time it becomes non-editable is if I click on a field in the subform and then click back to the main form. I have tried refreshing the form, changing the order of the code, seting focus to a field on the subform (which also does not work as when the form has finished loading, a field on the parent form has the focus) without success. I have stepped through the code, there is no other code firing save for the following after
Me.SFCUSTOMER_ADDR.Form.AllowEdits = False
How can I make this form non-editable?!
Thanks in advance for any help
Code:
DoCmd.OpenForm sDOCNM, , , sLINKCRIT, acFormReadOnly
I have tried the following code on both the Form_load and Form_Open events of the form being opened:
Code:
' If opened from SFCUSTOMER_ORDER for inquiry then form should be read-only
' for that customer
If Me.FilterOn = True Then
' Coming from another form. Make data display only
Me.AllowAdditions = False
Me.AllowEdits = False
Me.SFCUSTOMER_ADDR.Form.AllowAdditions = False
Me.SFCUSTOMER_ADDR.Form.AllowEdits = False
Me.SFCUSTOMER_ADDR.Form.SFCUSTOMER_CONTACT.Form.AllowEdits = False
Me.SFCUSTOMER_ADDR.Form.SFCUSTOMER_CONTACT.Form.AllowEdits = False
Me.SFCUSTOMER_PRODUCT_XREF.Form.AllowAdditions = False
Me.SFCUSTOMER_PRODUCT_XREF.Form.AllowEdits = False
' Hide the ADD/EDIT option group
Me.OptGrpACTION.Visible = False
Me.CbxSelRec.Visible = False
Else
' Not coming from another form. Allow full range of actions.
Me.AllowAdditions = True
Me.AllowEdits = True
End If
Me.SFCUSTOMER_ADDR.Form.AllowEdits = False
Code:
Private Sub Form_Current()
If Me.NewRecord Then
sKEYCRITERIA = "[CUSTOMER_ID]=" & Me.CUSTOMER_ID & " AND [ADDR_SEQ_NO]=" & Me.ADDR_SEQ_NO
' Get the next default SEQ_NO
Me.SEQ_NO.DefaultValue = GetSEQ_NO("CUSTOMER_CONTACT", "SEQ_NO", sKEYCRITERIA, _
"NEW", Nz(Me.SEQ_NO, "0"))
End If
' Capture Key Criteria
sKEYCRITERIA = "[CUSTOMER_ID]=" & Me.CUSTOMER_ID & _
" AND [ADDR_SEQ_NO]=" & Me.ADDR_SEQ_NO & " AND [SEQ_NO]=" & Me.SEQ_NO
End Sub
How can I make this form non-editable?!
Thanks in advance for any help