| re: a2k - irritating RI message
TC wrote:[color=blue]
> The deletion of the main record is firing the code that tries to add a
> record to the subform?
>
> HTH,
> TC[/color]
That did help TC. I started looking for some code and found a line that
executes the lostfocus event of a control in a subform.
This was introduced because of validation problems - I found I got a 2455
error when the lostfocus event fired on that control after having clicked
the Delete button, whereby Access claims i've put in an incorrect reference
(when I know full well this isn't the case).
One idea round this was to deliberately call the lostfocus event first in
the Delete button, but before the actual delete code. The 2455 error then
doesn't occur but then the error mentioned in my first post does.
Now that i've stopped calling that lostfocus event, it no longer appears.
This still means i have to rethink my validation and perhaps which buttons I
make available to the user. I do find that some of the interfaces I want to
implement just aren't catered for by the controls and their properties and I
have to resort to extreme workarounds and then wander into these bear traps.
<begins to sulk>
[color=blue]
>
>
> "Deano" <deanma66999@hotmail.com> wrote in message
> news:mKPAb.18474$lm1.155177@wards.force9.net...[color=green]
>> My form is set up so that if I add a record to my main form, a
>> related record is created in the subform. This occurs in the
>> afterupdate event of my main control.
>>
>> I have made a few changes here, nothing in my opinion that would
>> cause a problem.
>>
>> Now if I delete a main record and exit the form I am greeted with
>> this message;
>>
>> You cannot add or change a record because a related record is
>> required in table 'tblmain'
>>
>> The records and data therein are all OK after the deletion.
>>
>> Why is this message occurring? Am I missing some basic protocol I
>> should be following? If not how can I suppress this message?
>>
>> tia
>> Martin[/color][/color] |