Corrupt form?

L

Leslie Isaacs

Hello All

I have a form that has an OnOpen event, an AferInsert event and an
AfterUpdate event. Until yesterday they all worked fine, but then I tried
amending these events (without success). Now I find that either the form, or
all the events, have become corrupt, as when any event 'fires' I get the
message

"the expression OnOpen (or AferInsert or AfterUpdate) you entered as the
event
property setting produced the following error: Procedure declaration does
not match the description of event or procedure having the same name".

The only way I can get the form to open is to delete the event procedure for
the OnOpen event, and the only way I can use the form to insert or amend a
record is to remove those events.

As a trial, I removed the AfterInsert and AfterUpdate events, and set the
OnOpen event to the very simple
MsgBox ("Hello"), but event like this I get the above error message and
cannot open the form.

I desperately hope someone can help here - this form is needed daily and
without the original 3 event procedures it is almost useless.

Many thanks
Les
 
K

Keith Wilby

Leslie Isaacs said:
Hello All

I have a form that has an OnOpen event, an AferInsert event and an
AfterUpdate event. Until yesterday they all worked fine, but then I tried
amending these events (without success). Now I find that either the form,
or all the events, have become corrupt, as when any event 'fires' I get
the message

"the expression OnOpen (or AferInsert or AfterUpdate) you entered as the
event
property setting produced the following error: Procedure declaration does
not match the description of event or procedure having the same name".

The only way I can get the form to open is to delete the event procedure
for the OnOpen event, and the only way I can use the form to insert or
amend a record is to remove those events.

As a trial, I removed the AfterInsert and AfterUpdate events, and set the
OnOpen event to the very simple
MsgBox ("Hello"), but event like this I get the above error message and
cannot open the form.

I desperately hope someone can help here - this form is needed daily and
without the original 3 event procedures it is almost useless.

Many thanks
Les
Hi Les,

Have you tried "Compact & Repair"? Seems a bit odd.

I've had time to test what I was trying to do yesterday and the following
works:

Option Compare Database
Option Explicit
Dim strCurrentRecord As String, blnReturn As Boolean

Private Sub Form_AfterUpdate()

If IsNull(Me.txtText1) Then
If MsgBox("You've left it blank - intentional?", vbYesNo, "Confirm") =
vbNo Then
strCurrentRecord = Me.Bookmark
blnReturn = True
End If
End If

End Sub

Private Sub Form_Current()

If blnReturn = True Then
Me.Bookmark = strCurrentRecord
blnReturn = False
End If

End Sub

This is on a very simple form with just two text boxes but you should be
able to adapt it once you have your corruption situation sorted.
strCurrentRecord is a container for the current record's bookmark and
blnReturn is a container for the user's response as to whether or not they
want to move away from the last edited record.

HTH - Keith.
www.keithwilby.com
 
L

Leslie Isaacs

Hello Keith

Thanks for your suggestion: I have tried Compact and Repair, but
unfortunately with no result.
I have discovered that it is in fact all the form's event procedures that
don't work - i.e. including the OnClick events of all the buttons!

If you have any other ideas about how I might resolve this I (and certain
others here!) would be incredibly grateful!

Many thanks
Les
 
K

Keith Wilby

Leslie Isaacs said:
Hello Keith

Thanks for your suggestion: I have tried Compact and Repair, but
unfortunately with no result.
I have discovered that it is in fact all the form's event procedures that
don't work - i.e. including the OnClick events of all the buttons!

If you have any other ideas about how I might resolve this I (and certain
others here!) would be incredibly grateful!

Many thanks
Les
Does it compile OK, maybe there is a rogue line of code somewhere? Maybe a
decompile is worth trying but search for decompile on here first as it's
something I've never needed to do. Failing all that, have you tried
importing all objects into a new mdb file?

Keith.
 
B

BruceM

What did you try to amend? When you say you tried to make changes without
success, for what result were you hoping, and what happened instead? If you
post the code perhaps somebody here can see something that is amiss.
These thoughts are in addition to, not in place of, the other suggestions
you have received. Importing to a new blank database can be especially
helpful, and is quite simple: in the new database, File > Get External Data
Import. Importing menus and toolbars is an extra step. You will probably
find that the new database is rather smaller than the existing one. I don't
know why this is so, but it seems to be a good thing.
 
L

Leslie Isaacs

Hello Bruce

Thanks for your reply.

Unfortunately I am away now for a day and a half, but I will try your
suggestions when I get back: I hope this thread doesn't 'go cold'!

I'll post back when I have some results.

Thanks again
Les
 
L

Leslie Isaacs

Hello Keith

Thanks for your further reply.
Unfortunately I am away now for a day and a half, but I will try your
suggestions when I get back: I hope this thread doesn't 'go cold'!
I'll post back when I have some results.

Thanks again
Les
 

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

Similar Threads


Top