Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"An unexpected error has occurred" - A97

1 view
Skip to first unread message

MLH

unread,
Apr 3, 2006, 4:38:50 PM4/3/06
to
Private Sub ButtonP_Click()
On Error GoTo Err_ButtonP_Click
Dim ThisForm As String
ThisForm = Me.Name

Exit_ButtonP_Click:
Exit Sub

Err_ButtonP_Click:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in Sub ButtonP_Click,
CBF on " & ThisForm & "."
k = CRLF & CRLF & str$(Err) & ": " & Quote & Error$ & Quote
Message3 = r & k
MsgBox Message3, vbExclamation, "Unexpected Error - " & MyApp$ &
", rev. " & MY_VERSION$
Resume Exit_ButtonP_Click

End Sub

I have a problem with ButtonP on frmAdministrativeActivities. The
above code is what's run OnClick. There's no problem with the
MouseDown code. It runs fine. Of course, all the code compiles.
But OnClick of ButtonP, I get the unnumbered error. Strange is
that even when I delete ALL the ButtonP click code - the error
still persists on click of ButtonP. Ideas?

Allen Browne

unread,
Apr 3, 2006, 10:15:46 PM4/3/06
to
It is rather unusual to Dim variables in the error handler, and you are also
referring to other things we don't know about which could be part of the
problem (MyApp$ and MY_VERSION$.)

However, if the error persists even when *all* this code is removed, the
database has a corruption of the type that should be fixed by a decompile.

Suggested sequence:

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

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, and compact again.

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

"MLH" <CR...@NorthState.net> wrote in message
news:do1332lbjqiq98kb0...@4ax.com...

MLH

unread,
Apr 4, 2006, 2:19:29 AM4/4/06
to
Thx, Allen, for the insight. When I launch using

"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\db\timnall\N.mdb"
I get an unnumbered "Invalid Operation" error. If I click OK there, it
is followed by an "Unexpected Error 35012" msg. Clicking OK there,
I'm told to contact Microsoft Technical Support.

I'm thinking of exporting the entire database to text & rebuilding it
from the raw text files. I'd rather do only the problematic form. Can
I do that?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

MLH

unread,
Apr 4, 2006, 2:42:55 AM4/4/06
to
Allen, I tried this:
Application.LoadFromText acForm, "1234567890",
"c:\temp\frmAdministrativeActivities.txt"
after saving frmAdministrativeActivities to a text file.

It rebuilt frmAdministrativeActivities in the Forms tab
of the database window as "1234567890". Opening
that form and clicking ButtonP - identical same error.

Reducing the code behind ButtonP to this:
Private Sub ButtonP_Click()
End Sub
... I still get the same error message clicking on it.
Which is... "An unexpected error has occurred."

And finally, deleting the final 2 lines, removing all
the OnClick code for ButtonP - the same error occurs
when clicking the button. Hmmm???

Allen Browne

unread,
Apr 4, 2006, 4:33:02 AM4/4/06
to
If the decompile fails, it is time to create a new (blank) database, turn
Name AutoCorrect off, and import all the *other* objects.

Then decompile the new database, since importing the modules can import the
corruption. Create the form from scratch. Then paste in the code from
notepad if you wish.

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

"MLH" <CR...@NorthState.net> wrote in message

news:sm3432l2qhsqhfe30...@4ax.com...

David W. Fenton

unread,
Apr 4, 2006, 10:38:35 AM4/4/06
to
"Allen Browne" <Allen...@SeeSig.Invalid> wrote in
news:4431d6d4$0$2143$5a62...@per-qv1-newsreader-01.iinet.net.au:

> Suggested sequence:
>
> 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
>
> 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"

3b. Close the instance of Access that you used to decompile.

> 4. Open Access, and compact again.

5. open up the VBE and compile the Access project.

6. compact again.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

David W. Fenton

unread,
Apr 4, 2006, 10:39:53 AM4/4/06
to
"Allen Browne" <Allen...@SeeSig.Invalid> wrote in
news:44322f40$0$2127$5a62...@per-qv1-newsreader-01.iinet.net.au:

> If the decompile fails, it is time to create a new (blank)
> database, turn Name AutoCorrect off, and import all the *other*
> objects.

If I'm remembering correctly, MLH uses Access97, so Name AutoCorrect
wouldn't actually be relevant (if that's still true).

MLH

unread,
Apr 4, 2006, 10:44:09 AM4/4/06
to
On Tue, 4 Apr 2006 16:33:02 +0800, "Allen Browne"
<Allen...@SeeSig.Invalid> wrote:

>If the decompile fails, it is time to create a new (blank) database, turn
>Name AutoCorrect off, and import all the *other* objects.
>
>Then decompile the new database, since importing the modules can import the
>corruption. Create the form from scratch. Then paste in the code from
>notepad if you wish.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Am running A97. Don't have Name AutoCorrect.

Glad. Here's what I did.
I restarted Access. Created a new database (db2). I imported the form
using Application.LoadFromText acForm, "1234567890",
"c:\temp\frmAdministrativeActivities.txt" Then I removed all code
from ButtonP (OnClick and MouseDown). Clicking ButtonP - same
error.

So, I created a new form - blank. I opened 1234567890 in design view,
selected ButtonP, pressed CTRL-c, pasted it into the new form
(remember, it has NO code now). Saved new form as Form1. Opened
it. Clicked ButtonP. Same error. Opened Form1 in design view, added
a new button - no code. Saved it. Opened it. Clicked new button. No
error.

So. Error is specific to the command button. I've never seen this
before. I went back to the original database. I copied the ButtonP
click 'n mousedown code to notepad. I deleted ButtonP. I clicked
on ButtonO in design view, pressed CTRL-c, CTRL-v, renamed the
new command bttn to ButtonP, pasted in the code from notepad.
It worked. No error.

Allen Browne

unread,
Apr 4, 2006, 10:46:17 AM4/4/06
to
There has to be some kind of naming clash there.

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

"MLH" <CR...@NorthState.net> wrote in message

news:t6q432p0r1a6hup80...@4ax.com...

MLH

unread,
Apr 4, 2006, 10:57:28 AM4/4/06
to
Allen - I think I have a clue. Can you tell me
how to determine exactly when I installed the
SP2 update? I just did it in the past 2-3 weeks.
It took HOURS to run!

I am just now discovering that ALL my work in
all my databases having any modules with XML
calls has been HIDDEN. I cannot SEE the code.
I know its there, though. That's what's causing
the error I'm getting. I went back to apps I'd written
last June - none of the XML procedures appear
completely. The comments display. The error trapping
displays. The generic DIM stmts 'n such display. But
the real meat of the code is hidden somehow. Its
still there and trying to run - but I cannot see nor
modify it. How could MicroSoft bypass all my security
and modify my code w/o permission like that?

SP2 changed my PC somehow - I cannot launch
links in emails now by clicking on them. I have to
copy them and paste them DIRECTLY into IE for
them to work. I lost the ability to open a 2nd instance
of IE by holding down the SHIFT key and clicking
on a link in active IE window.

Even stranger, apps I've rolled out onto customer
sites with A97 runtime since installing SP2 are WORKING. The XML
calls are functioning. But I cannot see nor modify my code
here - and it is not working for me.

Allen Browne

unread,
Apr 4, 2006, 11:17:56 AM4/4/06
to
Sorry: I don't know anything about how Access 97 could be hiding XML code in
VBA. If anyone else does, please contribute.

The stuff that is happening outside of Access (such as how IE or OE work)
would be due to other security settings that have been changed with the
update, but the disappearing VBA code makes no sense to me.

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

"MLH" <CR...@NorthState.net> wrote in message

news:rm1532l824q65fn59...@4ax.com...

MLH

unread,
Apr 4, 2006, 11:39:44 AM4/4/06
to
My conclusions are probably wrong. But I have
presented the facts correctly. After installing SP2
sometime in the past month, I am unable to see
code in form modules that I wrote and could see
and modify prior to the SP2 update. This is true
in NUMEROUS databases - at least 20 I've examined
so far.
0 new messages