G
Guest
What is dbFailOnExecute and how would I use it?
sjw said:I used the following:
CurrentDb.Execute "DELETE * FROM tblItems WHERE [ItemID] = " _
& lstBEItems.Value, dbFailOnExecute
It worked fine and I was able to trape the error if the record was
already deleted, but I had to turn Option Explicit off. I found
dbFailOnExecute with the object browser under globals.
Why would I get a compile error, variable not defined, if it is
already a global thing?
Klatuu said:I have never heard of or can find any reference to dbFailOnExecute.
Someone invented that in your application.
You don't have to have Option Explicit off. I don't ever have a module
without it. It is a great safety net.
Change your code to use dbFailOnError and put Option Explicit back in.
Also, there are two issues with this reference:
lstBEItems.Value
First, you don't need the Value property. It is the default, and more
important, you should always qualify your control names with the form name.
Assuming the code is in the form module, it should be:
Me.lstBEItems
sjw said:I used the following:
CurrentDb.Execute "DELETE * FROM tblItems WHERE [ItemID] = " _
& lstBEItems.Value, dbFailOnExecute
It worked fine and I was able to trape the error if the record was already
deleted, but I had to turn Option Explicit off. I found dbFailOnExecute with
the object browser under globals.
Why would I get a compile error, variable not defined, if it is already a
global thing?
Thanks,
sjw