| | |
|
|
|
Error 2115 |
| message from Chuck Sears on 1 Jun 2004 |
I have an unbound text box on a form that is giving an
error 2115, saying that the BeforeUpdate or ValidationRule
for the field is preventing the update. There is no code
at all in the BeforeUpdate event and there are no
validation rules.
Help!!
If RS!ContactDeceased = "yes" Then
chkDeceased = 1
With txtDOD
.Visible = True
.SetFocus
.Locked = False
If Not IsNull(RS!dateofdeath) Then
sDOD = Format(RS!dateofdeath, "mm/dd/yyyy")
error occurs here>>> .Text = sDOD
Else
.Text = "Unknown"
End If
.Locked = True
End With
|
| Dirk Goldgar replied to Chuck Sears on 2 Jun 2004 |
"Chuck Sears" <hookkicker@yahoo.com> wrote in message
news:1675401c447f1$f8a17dc0$a301280a@phx.gbl
Chuck -
Where is this code being executed? It's quite likely that you don't
need all of that code to get the effect you want. In particular, you
don't need to SetFocus to the txtDOD control, because you don't actually
need to set its .Text property -- use its .Value property instead.
Try this: Make sure that the Format property of txtDOD (on its property
sheet in design view) is blank, and that its Locked property is True.
Then revise your code as follows:
If RS!ContactDeceased = "yes" Then
chkDeceased = 1
With Me.txtDOD
.Visible = True
If Not IsNull(RS!dateofdeath) Then
.Value = Format(RS!dateofdeath, "mm/dd/yyyy")
Else
.Value = "Unknown"
End If
End With
Else
' ... whatever
End If
|
| Raghu Prakash replied to Chuck Sears on 02 Jun 2004 |
Hi Chuck,
Commands Not Available During BeforeUpdate Event
http://support.microsoft.com/default.aspx?scid=kb;en-us;128195
Microsoft Knowledge Base Article - 128195
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.
Please let me know has this helped You...
Thank you...
Raghu...
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
Archived message: Error 2115 (MS Access Error Message)