Hi Everyone,
I have created two tables. Both tables have three fields in them, one
of the fields in each of the tables is a Key. The two tables have a
1-1 relationship setup with referential integerity, cascading delete
and update enforced.
I have created a form for each table to enter data into them. On the
forms I also have a button which closes the form, so the user can close
the form by closing the window (ie click on the X in the upper right
corner of the window) or the user can click on the close button I have
created. The code for the close button follows:
Private Sub Submit_Click()
On Error GoTo Err_Submit_Click
DoCmd.Close
Exit_Submit_Click:
Exit Sub
Err_Submit_Click:
MsgBox Err.Description
Resume Exit_Submit_Click
End Sub
Now heres my problem - if the user enters information on the record
that violates referential integerity and then clicks on the windows
close (ie the X) then Access will flag this as an error telling the
user that they cannot do this. Great. On the other hand if the user
clicks on the Button that I created, the form will close, but Access
will not give the errors - it does everything correctly just does not
display the errors.
If I set a break in debug and step through the code it will show the
errors, but if it is just allowed to run it does not even go to the
error routine.
I have already tried putting the code
DoCmd.SetWarnings True
in, but that did not help.
Any help would be welcome, thanks in advance.
Richard