Re: Messages at form closing?



Ah. So you were using the really nasty bug where Access does silently lose
the user's entry. We have that documented as the #1 flaw in Access here:
http://allenbrowne.com/bug-01.html

The real solution will involve using the Form_BeforeUpdate and Form_Error
events to handle the problems, and give the users a suitable notification
(custom messages if you wish.)

Who is this software for? I have yet to find anyone who complained about
these messages who--when it was explained to them--would prefer to have
Access just silently lose their data.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rodi" <Rodi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:57AD19E7-630D-475F-B799-2BD04D6019D0@xxxxxxxxxxxxxxxx
> Hey Allen,
>
> Thanks for your response.
>
> I get what mean about notification, but at that point, the record's
> already
> been saved. The genesis of all this is that I couldn't use a "normal" Add
> or
> Save command buttong, so I coded my own that updates to the degree I
> specified, and that works fine. But, when I tried to use the "X", I got
> the
> messages I specified.
>
> What I did was include a clos form command in the command button, which
> dos
> work, but I'd appreciate any other thoughts you have on this.
>
> Thanks
>
> "Allen Browne" wrote:
>
>> Yes, the default in Access is to save the record when you close the form,
>> move to a different record, filter the form, sort the form, and so on.
>>
>> And it's a *really* good idea that Access notifies you if your entry was
>> not
>> saved. Personally, if I found that I had bought a piece of software that
>> sometimes just silently lost whatever I entered with no notification at
>> all,
>> I would refuse to use the software and ask for my money back.
>>
>> It is possible to suppress those messages using a combination of the
>> Error
>> event of the form and the BeforeUpdate event of the form. But are you
>> sure
>> you want to just throw away people's entry and leave them with the belief
>> that "I entered it, but your program loses it!"
>>
>> "Rodi" <Rodi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:349E69F2-7370-4AA3-8223-871D32CF4A2F@xxxxxxxxxxxxxxxx
>> >
>> > I've a form with some subforms. One one of the subforms is a command
>> > button
>> > that updates the subform table record. This all works fine, however,
>> > when
>> > I
>> > "X" to close the subform, I get the two-headed message monster of:
>> >
>> > " The changes you requested to the table were not successful because
>> > they
>> > would create duplicate calues in the index, primary key, or
>> > relationship.
>> > Change the data in the field or fields that contain the duplicate data,
>> > remove the index, or redefine the index to permit duplicate entries and
>> > try
>> > again."
>> >
>> > and:
>> >
>> > "You can't save this record at this time. Do you want to close the
>> > database
>> > object anyway?"
>> >
>> > So, it seems the default of the "X" button is to update the table by
>> > creating a new record? Is there any way around this behavior or
>> > messages?
>> > I
>> > tried putting "DoCmd.SetWarnings False" in the BeforeUpdate event of
>> > the
>> > subform, but that didn't help.
>> >
>> > Thanks,
>> > Rodi


.