Re: Goes to Error Label even though err.number = 0

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Okay, if you are *certain* there is no way the logic could jump into the error handler of the procedure without an error, and that nothing else could be clearing the error, then I have to assume there is a corruption in the VBA. A decompile might fix it. Try this sequence (in order):

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact/Repair

3. Close Access. Make a backup copy of the file. Decompile the database by entering something like this at the command prompt while Access is not running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

4. Open Access (holding down the Shift key if you have any startup code), and compact again.

5. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

6. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

At this point, you should have a database where the name-autocorrect errors are gone, the indexes are repaired, inconsistencies between the text- and compiled-versions of the code are fixed, reference ambiguities are resolved, and the code syntax is compilable.

If it is still a problem, the next step would be to get Access to rebuild the database for you. Follow the steps for the first symptom in this article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html

--
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.

"Brian Watson" <BrianWatson@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C42D6E2A-8791-45DC-BA76-8CE34FC6CC0B@xxxxxxxxxxxxxxxx
Thanks for replying but I'm a very experienced programmer and would have
spotted such a mistake. No this is coded correctly but Access behaves in an
unpridictable manner.

"Allen Browne" wrote:

Error 0 usually means you forgot to include the:
Exit Sub
or
Exit Function
above the error handler.

As a result, the routine runs without error, but continues down into the
error handler.

"Brian Watson" <BrianWatson@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:118FBA89-8A22-4417-81F4-9DEBC1B4668A@xxxxxxxxxxxxxxxx
>I have a form (job) with a subform (items) the items have a size the job
>has
> an area. A command button runs a routine that calculate the quantity of
> items
> requied to cover the area. During the caluculation the quantity of each
> item
> on the form is updated. At the end of the caluculation the job form is
> updated with summary values. At the point of updating a job form field > the
> program jumps to the on error label set at the start of the routine > with
> an
> Err.Number = 0. Has anybody any ideas why? Is this something anybody > has
> ever
> experienced? Your comments would be gratfully received. If at the error
> label
> I resume the statement is executed without complaint and the routine
> completes. Unfortunately the next time the button is clicked the Access
> hangs.

.



Relevant Pages

  • Re: Goes to Error Label even though err.number = 0
    ... As a result, the routine runs without error, but continues down into the error handler. ... At the end of the caluculation the job form is ... If at the error label ...
    (microsoft.public.access.formscoding)
  • Re: Handling Bugs
    ... failed and then the database closes. ... following code in the error handler will it keep it from shutting down. ... That will happen if you use code without error handling, ... With all these forms and coding, I'm being haunted my minor bugs that keep ...
    (microsoft.public.access.formscoding)
  • Re: many inserts results in a massive reserved space for table
    ... run more quickly - again my not understanding SQL Server properly (not ... am inserting data into - please bear in mind though that I have no ... influence over the design of the database... ... I re-ran my routine against THE SAME SET OF DATA - this time the data ...
    (microsoft.public.sqlserver.server)
  • Re: Call a subroutine
    ... another database. ... call the procedure for that checkbox....the easiest solution being a routine ... Private Sub Command1_Click ... Dim x As Long ...
    (microsoft.public.vb.general.discussion)
  • RE: Newly getting started in C#
    ... listbox with names from 1 of the tables in the database. ... In VB I would create the connection to the database and connect to it in the ... records and close the recordset. ... for my initial connection and have the routine ConnectToDatabase() in the ...
    (microsoft.public.dotnet.languages.csharp)