Solved

Chasing down errors without that handy debug option

Posted on 2007-03-30
7
220 Views
Last Modified: 2012-08-14
I'm getting this error "The expression you entered refers to an object that is closed or doesn't exist" on one tabbed forms with multiple subs. And, "You entered an expression that has an invalid areference to the property Form/Report" on another. Is there a good way to debug? Or very common offenders that are a good place to start?

It's so much easier when the error message gives you a debug option that takes you to a line of code. I'm hoping there is some nifty way to narrow down the offender. The way I've been doing it is very slow going. I just start eliminated sub by sub and then control by control until I find the problem.

I'm going to be without an internet connection for the next several hours but I will be checking back in this evening to followup.

E
0
Comment
Question by:eliwil
7 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 18826510
In your VBA code window, go to Tools menu: Options
Click on Advanced tab
Set the Error Trapping option group to 'Break on All Errors'.

Save, close, and re-run.
When the error occurs again, this time code execution will stop on the line that cases the error.
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18826816
Every error has to begin with an event. You can always put a Breakpoint at the origin of the event in your code, then step through your code using <F8> from there. Your code (from what I've seen) uses a lot of FORMS! references and chances are, you're trying to set a value when the form is unavailable, or is named incorrectly. Shouldn't be too hard to find.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 18827250
I agree!
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 18827269
Because you haven't described the operation causing this error, I will make a guess (forgive me if I am wrong about it). For whatever worth, I am going described a situation and offer asolution to handle this kind of errr.

Operation: You are trying to update the information in a text box via code and you are getting this error.

Solution: Set the focus to the subform if the text box is on the subform and your code is not on the subform. Then, send focus to the text box before setting the text box to the new value.

Mike
0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 18827273
... Then, send the focus to the text box which is on the subform before setting the text box to the new value.
0
 

Author Comment

by:eliwil
ID: 18827656
nailed it!
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18827667
Dang Mike...I thought you had it!
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Office 365 home questions 7 65
vba sql wild card passing in code 3 24
Passing variables to a function 6 36
Sum with where criteria on a report 5 13
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.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

777 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