ACC2000: Form Is Editable When AllowEdits Property Set to FalseID: Q200590
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you open a Microsoft Access form that has the AllowEdits property set to No (False), you can still edit the fields on that form.
This behavior occurs if you set the value of a control programmatically in the Current event of the form. It also occurs if you set the value of a control in the Load event of the form. In that case, however, the only record that you can edit is the first record that is displayed on the form.
Microsoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.aspIf you need to edit the values of bound fields programmatically in forms that have the AllowEdits property set to False, edit those fields in the RecordsetClone of the form, and not in the form itself.
Private Sub Form_Current()
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Form.Bookmark
rs.Edit
' The following updates the CompanyName field to itself plus the
' letter "a".
rs!CompanyName = rs!CompanyName & "a"
rs.Update
End Sub
Private Sub Form_Current()
' The following updates the CompanyName field to itself plus the
' letter "a".
Me!CompanyName = Me!CompanyName & "a"
End Sub
?Forms!Customers.AllowEdits
Note that the property is set to False, but that you are able to edit fields on the form.
For more information about the AllowEdits property, click Microsoft Access Help on the
Help menu, type "AllowEdits property" in the Office Assistant or the Answer Wizard,
and then click Search to view the topic.
For more information about the RecordSetClone property, click Microsoft Access Help on the
Help menu, type "RecordSetClone property" in the Office Assistant or the Answer Wizard,
and then click Search to view the topic.
Additional query words:
Keywords : kbusage kbdta FmsEvnt FmsProp
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: July 13, 1999