From: Arvi Laanemets on
Hi

Thanks!

This link refers to almost same solution I found myself. But DBEngine.Errors
doesn't work for me. There exists only one item DBEngine.Errors(0) with
Number=3001 - "Invalid argument". And it doesn't depend on my actions which
caused the error (i.e. deleting linked data or entering some duplicate
value).

"Stefan Hoffmann" <ste5an(a)ste5an.de> kirjutas s�numis news:
O#E#eNV4KHA.1452(a)TK2MSFTNGP06.phx.gbl...
> hi Arvi,
>
> On 21.04.2010 14:08, Arvi Laanemets wrote:
>> I think, the problem is that the error doesn't occur in Access, so
>> Access error indicators get nothing to show - the only exception are
>> parameters for forms OnError event DataErr and Response. (P.e. when
>> trying to delete a record linked to other tables, DataErr=3146 and
>> Response=1)
> E.g.
>
> http://archive.baarns.com/access/faq/ad_error.asp
>
>
> mfG
> --> stefan <--

From: Stefan Hoffmann on
hi Arvi,

On 21.04.2010 15:53, Arvi Laanemets wrote:
> This link refers to almost same solution I found myself. But
> DBEngine.Errors doesn't work for me. There exists only one item
> DBEngine.Errors(0) with Number=3001 - "Invalid argument". And it doesn't
> depend on my actions which caused the error (i.e. deleting linked data
> or entering some duplicate value).
Ah, I see, take a look at

http://support.microsoft.com/default.aspx?scid=kb;en-us;206175

mfG
--> stefan <--
From: Arvi Laanemets on
Thanks!

It was what I was searching for! (Almost.)

The function works fine when I'm adding or editing a record. Unfortunatelly
it looks like MS has forgotten the case, when records are deleted - so
probably I have to find the solution myself. I haven't worked much with
recordsets per VBA, so there is a lot of reading to be done.

It looks like form's Delete event will be a right place to call a function
which will delete ODBC records. And probably I'll write a separate function
to be called from Delete event

Maybe I can get some hints:
1) how to get information, which records were marked for deletion on form
(as all my forms are continous, unlike adding/editing the record, the user
can delete several records at once)?;
2) when some records marked for deletion pass the check, and some not, is it
better to rollback the whole operation? Or is it better to handle every
marked record separately?


Arvi Laanemets


"Stefan Hoffmann" <ste5an(a)ste5an.de> kirjutas s�numis news:
#Vj1uJW4KHA.4952(a)TK2MSFTNGP02.phx.gbl...
> hi Arvi,
>
> On 21.04.2010 15:53, Arvi Laanemets wrote:
>> This link refers to almost same solution I found myself. But
>> DBEngine.Errors doesn't work for me. There exists only one item
>> DBEngine.Errors(0) with Number=3001 - "Invalid argument". And it doesn't
>> depend on my actions which caused the error (i.e. deleting linked data
>> or entering some duplicate value).
> Ah, I see, take a look at
>
> http://support.microsoft.com/default.aspx?scid=kb;en-us;206175
>
> mfG
> --> stefan <--

From: Stefan Hoffmann on
hi Arvi,

On 22.04.2010 09:41, Arvi Laanemets wrote:
> It was what I was searching for! (Almost.)
>
> The function works fine when I'm adding or editing a record.
> Unfortunatelly it looks like MS has forgotten the case, when records are
> deleted - so probably I have to find the solution myself. I haven't
> worked much with recordsets per VBA, so there is a lot of reading to be
> done.
Use the On Delete event of the form. Set Cancel to True and delete the
record manually using

CurrentDb.Execute "DELETE FROM ...", dbFailOnError


mfG
--> stefan <--