Hello
I have a small database, where names of applicants are recorded with
some other data. If an applicant telephones twice, he can be recorded
twice.
I am trying to check - by name.
When in OnBeforeInsert event of the form, the following code starts
(checked by inserting breakpoint in the code) immediately after
pressing the first key. Naturally it doesn't find anything, because
nothing is entered yet.
When in OnAfterUpdate event, it always finds, - unique name or not. Of
course, the record is already saved.
Where would you recommend to run the following code:
Dim rst As DAO.Recordset, strStudent As String, Resp
Set rst = Forms!frmStudents.RecordsetClone
With rst
strStudent = "[Student Name] = '" & Me![Student Name] & "' AND
SURNAME='" & Me![Surname] & "'"
rst.FindFirst strStudent
If rst.NoMatch Then
Else
Resp = MsgBox("There is a student with the same name. Would you
like to see?", vbYesNo, "CON Faculty waiting lists")
If Resp = vbYes Then
Call FindStudent(Me![Student Name], Me!Surname)
End If
End If
End With
Set rst = Nothing
Thank you.
Galina