Re: Catch errors on append query

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Graham R Seach (gseach_at_NOSPAMpacificdb.com.au)
Date: 05/28/04


Date: Fri, 28 May 2004 12:38:59 +1000

Bruce,

If the IF statement is true, then there MUST be an error. Change your code
as follows, and let me know what the result is:
    CurrentDb.Execute "qry_Append_LTD", dbFailOnError
    MsgBox (Err)
    If Err <> 0 Then
        MsgBox Err.Number & vbCrlf & Err.Description
    Else
        MsgBox "PAF has been saved successfully"
    End If

If this doesn't show anything useful, it might be time to send me the
database so I can take a look. I'm working in the dark here, because I don't
have your table structure, data, and queries to test.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html

"Bruce" <anonymous@discussions.microsoft.com> wrote in message
news:3DBD106B-8981-4AFB-8053-31B187A060FA@microsoft.com...
> Bruce,
>
> No error code. When I step through the following the if statement is true.
> i.e. "The record could not be added."
>
> when i run "qry_Append_LTD" by open query rather than execute its ok. I am
totally puzzled....
>
> CurrentDb.Execute "qry_Append_LTD", dbFailOnError
> MsgBox (Err)
> If Err <> 0 Then
> MsgBox "The record could not be added."
> Else
> MsgBox "PAF has been saved successfully"
> End If
>



Relevant Pages

  • Re: Actually...
    ... "Graham R Seach" wrote: ... MsgBox "Duplicate Entry" ... Microsoft Access MVP ...
    (microsoft.public.access.formscoding)
  • RE: Actually...
    ... "Graham R Seach" wrote: ... Microsoft Access MVP ... MsgBox "Duplicate Entry" ...
    (microsoft.public.access.formscoding)
  • Re: Filter a drop down list?
    ... There are too many same counties with different states and it gets ... "Graham R Seach" wrote: ... >> Microsoft Access MVP ...
    (microsoft.public.access.forms)
  • Re: Two forms, one entry
    ... Microsoft Access MVP ... Graham R Seach wrote: ... shuts down the application, the login form unloads, firing the Unload ...
    (microsoft.public.access.formscoding)
  • Re: New Post - Owner deleted - No backups, nothing!
    ... Graham: Thanks for your help on this! ... "Graham R Seach" wrote: ... order to discover the Admin password. ... Microsoft Access MVP ...
    (microsoft.public.access.security)