PDA

Click to See Complete Forum and Search --> : Problem with Validate Event


wick77
Jun 30th, 2000, 11:21 AM
I have been using the Validate event with great success but am having one problem. If I delete all the data from a text box at once and validate I get an error saying it was cancelled by an associated object. If I say 'NO' to save then I have no problems. It does not like saving a NULL value to the Database. (I am using an Access 97 Database, I removed all constraints and relationships to see if that made a difference, it didn't). Here is the code I'm using to Validate:

Private Sub Data1_Validate(Action As Integer, Save As Integer)
Dim reply
If Text1.DataChanged Or Text2.DataChanged Or Text4.DataChanged Or Text5.DataChanged Or Text6.DataChanged Or Text7.DataChanged Or Text8.DataChanged Or Text9.DataChanged Or Text10.DataChanged Or Text11.DataChanged Or Text12.DataChanged Or Text13.DataChanged Or Text14.DataChanged Or Text15.DataChanged Or Text16.DataChanged Or Text17.DataChanged Or Text18.DataChanged Or Text19.DataChanged Or Text20.DataChanged Or Combo1.DataChanged Or Combo2.DataChanged Then
reply = MsgBox("Record has been changed. Save?", vbYesNo)
If reply = vbNo Then
Save = False
End If
End If

Pretty basic code, If anyone can give me any ideas I would appreciate it,
Thanks,
Adrian Wickenheiser