"The value in the field or record violates the validation..."

  • Thread starter leahf via AccessMonster.com
  • Start date
L

leahf via AccessMonster.com

There exists a student form both for updating student data and for entering
student data.

One of the fields is the social security number, and in the BeforeUpdate
event of the field there is a validity check.

It works perfectly when student data is updated. However, when entering new
student data, if the social security number does not pass the validity there
is MessageResponse whether or not the user wants to correct the data. If no,
then the form is cancelled.

If yes, then only the FIRST time do I get the message "The value in the
field or record violates ...". After that, it works without a problem. The
user can then correct the data without a problem. No matter how many times
it fails the validity check, the error message will not appear.

Can anyone explain what is going on and what I can do to rectify the
situation?

Thanks.
Leah
 
L

leahf via AccessMonster.com

Hi John,

I guess I was thinking more as a general question, but you're right...

l_length = Len(Me.student_id_num)
If l_length <> 9 Then
MsgResponse = MsgBox("Length... Do you want to correct this?",
vbYesNo)

If MsgResponse = vbNo Then
If iNewRec = True Then
Exit Sub
Else
Me.Undo
Exit Sub
End If
End If
' response is yes and then problem the first time
Cancel = True
Exit Sub
End If

Thanks.
Leah
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top