ACC2: DefaultEditing Set to "Can't Add Records" Removes FilterID: Q129302
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you use Access Basic code to set a form's DefaultEditing property to
Can't Add Records, any filter that you apply to the form is removed and all
the records are displayed.
To work around this problem, re-apply the filter after you set the DefaultEditing property to Can't Add Records.
Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.
Because the Can't Add Records option for the DefaultEditing property is not
available in the OpenForm macro action's Data Mode argument, you must use
Access Basic code to set the property in the form's Load event. But if you
set the property in the form's Load event, when the form opens, any filter
you apply to the OpenForm action's Filter Name or Where Condition argument
is removed.
For more information about opening a form with the Can't Add Records data
mode, please see the following article in the Microsoft Knowledge Base:
Q129301 ACC2: No "Can't Add Records" Data Mode Arg. in OpenForm
Action
Sub Form_Load (Cancel As Integer)
' Set the DefaultEditing property to the value passed in the
' OpenArgs argument.
Me.DefaultEditing = Me.OpenArgs
End Sub
Sub Form_Load ()
Dim iSemicolon As Integer
Dim iDefaultEditing As Integer
Dim sWhereCondition As String
' Find the semicolon.
iSemicolon = InStr(Me.OpenArgs, ";")
' If the semicolon is found...
If iSemicolon > 0 Then
'...parse the DefaultEditing property and WhereCondition
'argument...
iDefaultEditing = Left(Me.OpenArgs, iSemicolon - 1)
sWhereCondition = Mid(Me.OpenArgs, iSemicolon + 1)
'...and set the DefaultEditing property and WhereCondition
'argument.
Me.DefaultEditing = iDefaultEditing
If sWhereCondition <> "" Then
DoCmd ApplyFilter , sWhereCondition
End If
End If
End Sub
For more information about the DefaultEditing property, search for "DefaultEditing," and then "AllowEditing, DefaultEditing Properties" using the Microsoft Access Help menu.
Keywords : kbusage FmsProp
Version : 2.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 9, 1999