ACC2: "Reserved Error" Message with No Error CodeID: Q126825
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you use the SetFocus method in an event procedure, you receive the
error message "Reserved Error" without any other error code or explanation.
The form containing the event procedure is based on a table or query with no records, and the form is either read-only or its DefaultEditing property is set to Read Only or Can't Add Records. The SetFocus method must identify the current record before it can move the focus to another control. If there are no records and you cannot create a new record, then there is no current record. An attempt to identify the current record results in an error.
Make sure that the table or query on which the form is based contains at least one record, or include logic in your event procedure to avoid using the SetFocus method if there are no records.
This behavior no longer occurs in Microsoft Access version 7.0.
The GoToControl action also causes an error under the same circumstances,
but it issues a more informative error (2105, "Can't go to specified
record"). Both the GoToControl action and the SetFocus method attempt to
identify the current record. If the form is based on a table or query with
no records, there is no current record and an error occurs.
Note that when a form is based on a table or query with no records, none
of the controls in the form's detail section appear, including unbound
controls. Unbound controls in a header or footer section do appear. This
error occurs even when you try to set the focus to an unbound control that
is visible in the form header or footer.
Query: ReservedErrorsQuery
--------------------------
Type: Select Query
Field: *
Table: Employees
Field: Employee ID
Criteria: < 0
Me!MyUnboundCtl.SetFocus
DoCmd GoToControl Me!MyUnboundCtl.Name
If Me.RecordsetClone.RecordCount > 0 Then
Me!MyUnboundCtl.SetFocus
End If
Keywords : kberrmsg kbusage FmsEvnt
Version : 2.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: April 9, 1999