By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,905 Members | 902 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,905 IT Pros & Developers. It's quick & easy.

"An unexpected error has occurred" - A97

P: n/a
MLH
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?
Apr 3 '06 #1
Share this Question
Share on Google+
11 Replies


P: n/a
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:do********************************@4ax.com...
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?

Apr 4 '06 #2

P: n/a
MLH
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?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx
On Tue, 4 Apr 2006 10:15:46 +0800, "Allen Browne"
<Al*********@SeeSig.Invalid> wrote:
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.


Apr 4 '06 #3

P: n/a
MLH
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???
Apr 4 '06 #4

P: n/a
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:sm********************************@4ax.com...
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?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx
On Tue, 4 Apr 2006 10:15:46 +0800, "Allen Browne"
<Al*********@SeeSig.Invalid> wrote:
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.

Apr 4 '06 #5

P: n/a
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in
news:44**********************@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/
Apr 4 '06 #6

P: n/a
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in
news:44**********************@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).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 4 '06 #7

P: n/a
MLH
On Tue, 4 Apr 2006 16:33:02 +0800, "Allen Browne"
<Al*********@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.
Apr 4 '06 #8

P: n/a
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:t6********************************@4ax.com...
On Tue, 4 Apr 2006 16:33:02 +0800, "Allen Browne"
<Al*********@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.

Apr 4 '06 #9

P: n/a
MLH
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.

Apr 4 '06 #10

P: n/a
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:rm********************************@4ax.com...
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.

Apr 4 '06 #11

P: n/a
MLH
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.
Apr 4 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.