Originally Posted by
sneuberg
...In our database the afterupdate for the textbox which maintains the primary key calls a subroutine which upon detecting an existing record gives the user the option of going to that record or not...
This type of code belongs in the BeforeUpdate event of the Textbox, not the AfterUpdate event, then use Cancel = True to prevent the creation of the New Record. Typical code for this kind of thing would be
Code:
Private Sub Field1_BeforeUpdate(Cancel As Integer)
If DCount("Field1", "Domain", "Field1 = " & Me.Field1) > 0 Then
Resp = MsgBox("This Value Already Exists! Please Enter New Value")
Cancel = True
End If
End Sub
To be honest, I'm a little fuzzy as to your process, here, but this change may serve your needs.
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007