Solved

Why does Stop not stop

Posted on 2013-12-10
5
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

740 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