Home   |   Asp.Net 2.0   |   .Net Framework 2.0   |   IIS 6.0   |   Sql Server 2005   |   Visual Basic 2005   |   c# 2005   |   VS 2005   |   Visual Source Safe 2005

MS Dynamics CRM 3.0

SharePoint Portal Server 2003
SharePoint Server 2007
Dynamics NAV
Dynamics CRM
SharePoint Designer 2007
SharePoint Portal Server 2001
Windows SharePoint Services
Windows SharePoint Services 3.0
Project Server 2003
Project Server 2007
Dynamics – Point of Sale
Dynamics AX
Dynamics GP
Dynamics Retail Management System (RMS)
Dynamics SL
SQL Server 2000
Visual Basic .NET 2003
Visual C# .NET 2003
Visual C++ .NET 2003
Visual C++ 2005
Visual SourceSafe 6.0
Windows Server 2003
Windows Server 2003
Outlook 2003
ADO.NET 1.1
ASP.NET 1.0
Visual Studio Team Foundation Server
Visual Studio 2005 Team Edition
Windows Internet Explorer 7
BizTalk Server 2000
BizTalk Server 2002
BizTalk Server 2004
BizTalk Server 2006
Visual Studio 6.0
Access 2000
Access 2002
Access 2003
Access 2007
Access 97
Collaboration Data Objects 2.0
Commerce Server 2002
Content Management Server 2001
Commerce Server 2007
Content Management Server 2002
Data Access Components 2.7
Data Access Components 2.8
DirectX 9.0b
Office Small Business Accounting 2006
Accounting 2007
ActiveSync 4.1
Class Server 2.0
Groove 2007
Windows Vista
Outlook 2007
OneNote 2003
OneNote 2007
Office X for Mac
Zune software
Zune Live
Zoo Tycoon 2
Flight Simulator 2002
Dungeon Siege II

Cervo Technologies
The Right Source to Outsource

Oracle Database FAQS

Sharepoint Portal Server KB

Outlook 2007 Knowledge Base Articles

Access 97 Knowledge Base Articles

Advanced: Requires expert coding, interoperability, and multiuser skills. When you perform an action in the BeforeUpdate event, you receive the following error messages, even if you have canceled the event. In Microsoft Access 7.0 and 97: -...


Advanced: Requires expert coding, interoperability, and multiuser skills.

When you perform an action in the BeforeUpdate event, you receive the following error messages, even if you have canceled the event.

In Microsoft Access 7.0 and 97:
- Runtime error '2105'
You can't go to the specified record

- Runtime error '2115'
The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field.

In Microsoft Access 2.0:
- Field or record can't be saved while it's being validated.

- Command not available: UndoCurrentRecord.

- Can't go to specified record.

CAUSE

Microsoft Access cannot perform the specified command because the BeforeUpdate event procedure is still running. This is true even if the Cancel parameter is set to True or if a CancelEvent macro attempts to cancel the action.

These error messages are generated by the following statements in the BeforeUpdate event procedure:
' Undo the current record. (Microsoft Access 2.0 only)

' NOTE: This behavior no longer occurs in Microsoft Access 7.0 and 97)

DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, 1

' Goto a new record.
DoCmd.GoToRecord , , acNewRec '(Microsoft Access 7.0 and 97)
DoCmd GoToRecord , , A_NEWREC '(Microsoft Access 2.0 )

' Find a record
DoCmd.FindRecord "Smith", , True, acAll, True '(Microsoft Access 7.0 and 97)
DoCmd FindRecord "Smith", , True, A_ALL, True '(Microsoft Access 2.0)

RESOLUTION

Instead of setting the Cancel parameter to True, or using the CancelEvent action, use a SendKeys statement if that is an option with the command you are trying to use. The SendKeys statement sends keystrokes to the Microsoft Access buffer, where they wait until the BeforeUpdate event procedure is finished.

MORE INFORMATION

To go to a new record before the BeforeUpdate event procedure is finished, use the following code for the BeforeUpdate property's event procedure:
   Sub Form_BeforeUpdate (Cancel As Integer)
     Dim Msg As String

     Msg = "Would you like to go to a new record?"
     If MsgBox(Msg, 32 + 4) = 6 Then
       ' SendKeys "%egw" '(for Microsoft Access 7.0 and 97)
       ' SendKeys "%rgw" '(for Microsoft Access 2.0)
     End If

   End Sub
				

NOTE: In some cases, you will need to include the CancelEvent action along with the SendKeys statement as in the following:

To undo the current record (in Microsoft Access 2.0 only), in place of the following line to undo the current record
   DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, 1
				

use the SendKeys statement along with the CancelEvent action:
   Docmd CancelEvent
   SendKeys "{ESC}{ESC}"
				

To navigate to a new record, instead of the following code
   DoCmd.GoToRecord , , acNewRec  '(for Microsoft Access 7.0 and 97)
   DoCmd GoToRecord , , A_NEWREC  '(for Microsoft Access 2.0)
				

use the following SendKeys statement:
   SendKeys "%egw" '(for Microsoft Access 7.0 and 97)
   SendKeys "%rgw" '(for Microsoft Access 2.0)
				

For an additional example of how to use this technique, please see the following article in the Microsoft Knowledge Base:

ACC2: How to Find a Record Using a Bound Control

Steps to Reproduce Behavior


1.Open the sample database Northwind.mdb (or NWIND.MDB in Microsoft Access 2.0).
2.Open the Customers form in Design view.
3.Set the form's BeforeUpdate property to the following event procedure:
      Sub Form_BeforeUpdate (Cancel As Integer)
      Dim Msg As String
          Msg = "Would you like to go to a new record?"
          If MsgBox(Msg, 32 + 4) = 6 Then
             ' User chose Yes so undo the current record.
              DoCmd.GoToRecord , , acNewRec '(for Microsoft Access 97 only)
             ' In Microsoft Access 2.0 use the following line instead:
             ' DoCmd GoToRecord , , A_NEWREC
          End If
      End Sub
						
4.View the form in Form view.
5.Change the data in any field, and then click Save Record on the Records menu.
6.When you are prompted "Would you like to go to a new record?" click Yes. Note that you receive the following error message.

In Microsoft Access 7.0 and 97:
Runtime error '2105'
You can't go to the specified record
In Microsoft Access 2.0:
Can't go to specified record

REFERENCES

For more information about SendKeys, search for "SendKeys Statement" using the Microsoft Access Help Index.


APPLIES TO
Microsoft Access 2.0 Standard Edition
Microsoft Access 95 Standard Edition
Microsoft Access 97 Standard Edition

Keywords: 
kberrmsg kbprb kbusage KB128195

Copyright © 2004 - 2007 Gridview.org, Inc. All rights reserved. Powered by Smart Web Content Management System