Error Handler Does Not Break On Very Simple Example

  • Thread starter Tony Colson via AccessMonster.com
  • Start date
T

Tony Colson via AccessMonster.com

Hello All,

I have a rather large Access application that used to work completely before
I installed Visual Studio .Net (maybe that means something)?

Prior to installing VS .Net my code would appropriately break when I tried
indexing into a Collection by key if there was no object in the Collection
with that key.

For example the following scenario previously would work fine:

Public Sub testcollection()
Dim c1 As New collection, c2 As New collection
Const NAME = "sss"

c1.Add c2, NAME
Set c2 = Nothing

On Error GoTo NO_OBJ:
Set c2 = c1.item(NAME) ' This line works
Set c2 = c1.item("qqq") ' Code Breaks here; should go to NO_OBJ:

Exit Sub

NO_OBJ:

Debug.Print "No Object"
End Sub

This code snipet now fails when I try to run it.

I suspect someting along the lines of:

1) A VS .Net .dll containing Microsoft.VisualBasic.Collection is
interfering with the VBA.Collection

2) VS.Net overwrote a dll containing a dependency of VBA.Collection

But, I haven't had any luck with these approaches, yet.

Are there any other ideas on this topic?
 
T

Tony Colson via AccessMonster.com

Thanks for replying John,

Actually, the problem was with the Error Trapping configuration setting on
the General tab under Tools | Options. Setting it to Break on Unhandled
Errors fixed the problem.

VS .Net must have changed something on my computer. I had to generate my
report (successfully using the application) on another computer and when I
checked its Error Trapping setting I found it was set to Break on Unhandled
Errors. Changing that setting on my computer then allowed my application to
run as before. So, this appears to be the only thing that changed. Although
it was bedeviling, thank God it wasn't someting more sinister... ;)

Thanks
Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top