Solved

Why does Stop not stop

Posted on 2013-12-10
5
286 Views
Last Modified: 2013-12-11
I often get the condition where a Stop line of code gets ignored.  The only solution I have found is to create a new database and import everything into it.

Does anyone know why this happens and if there is anything I can do to prevent it?

Thanks in advance.
0
Comment
Question by:CRB1609
5 Comments
 
LVL 15

Expert Comment

by:ChloesDad
ID: 39710697
The obvious answer is that the line is not being executed, and hence the breakpoint never happens.

Alternatively, if you are running in Release mode then breakpoints are ignored.
0
 

Author Comment

by:CRB1609
ID: 39710710
1. The immediate preceding and subsequent lines are being executed.

2. I'm running a normal accdb.
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39710945
CRB1609: You included the .NET zone here. Are you using VB.NET for this, or is this all contained in Access? I believe the comment from ChloesDad is intended for the .NET languages, which have a Debug and Release mode ...

==============================

Assuming this is an all-Access project, then issues like this are a sign of corruption in the database, and moving to a new container as you're doing now is the only real "fix" for it.

Corruption happens for many reasons, but to reduce the chances:

-- Never modify code in break mode. Never.

-- Split the database into a Backend (tables only) and a Frontend (everything else). The chances for corruption are much greater for forms/reports, etc than for tables.

-- Turn OFF Name AutoCorrect. You don't need it. You really don't.

-- Compile your code frequently. To do that, from the VBA Editor window click Debug - Compile, fix any errors, and continue doing this until the Compile option is disabled. When you make code changes, you'll have to compile again.

-- Don't use 3rd party controls or libraries unless they are compliant with Access (and there are very, very few of those). Just because "it works" doesn't mean it works. This includes ALL Microsoft Controls as well (none of them are "compliant" with Access 2010).

-- Compact your database frequently. In 2010 the Compact option is right on the main backstage menu, so get in the habit of doing this frequently.

-- Never work on a live database.

-- Decompile your code occasionally. This helps to clean up the PCode contained in Access, which can get out of whack occasionally. To Decompile, build a shortcut with a Target like this:

  "Full path to msaccess.exe" "full path to your db" /decompile.

Run that shortcut, then compile and compact

-- Always work on LOCAL copies of the database. Never try to open a remotely hosted database across the LAN - even on local networks. Move the file to your machine and do the work there.

-- Make backups frequently. This doesn't help to reduce corruption, but it puts your mind at ease.

-- Make sure your Office system is fully up to date in regard to service packs, updates, etc. Same goes for Windows.
0
 
LVL 12

Expert Comment

by:pdebaets
ID: 39712570
If you are executing in runtime mode, the Stop statement will not execute.
0
 

Author Closing Comment

by:CRB1609
ID: 39712956
Very helpful.  Doing some of it but the other stuff is great.  

Thanks very much.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now