Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Procedure Call or Argument error

Status
Not open for further replies.

BlackBearDude

Programmer
Jan 13, 2003
33
0
0
US
What would cause this error on something as simple as placing a

MsgBox "Hello World"

line of code in an OnActivate event of a report or form?
 
Are you sure this code is in a event procedure, ie between Private Sub myForm_Activate() ... End Sub ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yes ... as follows:

Private Sub Form_Activate()
MsgBox "Hello World"
End Sub
 
For the record, this error occurs with any code placed in any event in a form or a report.
 
One possible answer is a missing Reference.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
You might try opening up the References dialog and see if any are MISSING.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Can you get a clean compile of the program?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Yes, everything is fine until a form or report is run. Then the Invalid Procedure Call or Argument. Very strange. Can't seem to find any reason for this to be happening.

Just for test purposes, I'm inserting simple MsgBox lines within event code. It's happening consistently everywhere.
 
BlackBearDude said:
Yes, everything is fine until a form or report is run
How far do you get into your application before you load a form?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
This is happening on stand-alone forms, simply "opening" the form which (in the ex. fires OnActivate) immediately causes the error.
 
I created an empty database and exported all of the relevant forms, tables queries to it.

I added a MsgBox "Hello World" to the OnActivate event and guess what? It is working.

I checked all of the references in the new DB and they are the same references as in the original DB (where no event code would execute at all).

Now, my question is: is there a setting somewhere that can cause the behavior that I experience?

Obviously, by placing these individual components into a new DB I've somehow bypassed the cause of the problem.

Any thoughts?
 
Hi!

I don't think there's any setting;-)

I think what has happened, is a corruption of some part of the code. Some of the reasons for that to happen on a stand alone, is amongst other, developing, testing and running unsaved uncompiled code (perhaps also unsaved changes to objects on forms/reports?). There are many other possible reasons too... (but do learn, and use ALT+D+Enter (in VBE) and CTRL+S;-))

Copying all objects to a new database, in a lot of cases, resolves the situation, hovewer, I've seen some references to a possible bug in some Access versions/SP... where copying/exporting might also cause corruption. I've worked with 97 thru xp and been fortunate not to have experienced that.

Should more code corruption occur, on my setup, the /decompile option, always resolves the issue, without having to copy all the objects.

Here's a link to that:
Decompile or how to reduce Microsoft Access MDB/MDE size and decrease start-up times

And also a link on db corruption:
Corrupt Microsoft Access MDBs FAQ Do also check out MakeItSo's faq faq705-4683.

Roy-Vidar
 
Thanks for the info. However, if another form - one that I did not open - had corruption in any code, could that still cause this error in another form totally unrelated to the one with corrupt code? The reason I ask, is that I can place the snippet specified earlier into virtually any event in any form and the error occurs.

I'd rather not have to copy all objects to a new DB since there are over 300 objects in all. Unless there's a way to do a "mass export" instead of one object at a time.

Now, if I do copy all objects to another DB will the new DB be 100% complete provided that every object is copied? Or can something linger behind that I may be unaware of?

Thanks
 
Interesting ... clicking on the Compile menu item in the VBE also causes the error "Invalid Procedure Call".
 
Sorry, I don't have the foggiest what that might mean.

It could perhaps indicate that it was not a corruption issue, but rather some coding errors. By your answer to CajunCenturion's question "Can you get a clean compile of the program?" I didn't even consider anything but corruption.

Should it still be code corruption, then to repeat:
myself said:
Should more code corruption occur, on my setup, the /decompile option, always resolves the issue, without having to copy all the objects.

Here's a link to that:
Decompile or how to reduce Microsoft Access MDB/MDE size and decrease start-up times
I haven't exported/imported objects because of code corruption issues since I became aware of this option.

When/if you try export/import objects containing corrupted code, the process halts (and, when in the import dialog, you can select more than one object) - but my experience of using this method is outdated, since the /decompile has worked painlessly for years.

There are no warranties. You might be lucky, but then you might not. In some cases, there's even a need to recreate lot of the stuff from scratch (or use the latest backup, but since there also might be "starting" corruption there, too, some of the mentioned actions might also be performed on that)

The links I gave, can provides more and better information then I can give. You'll just have to try - just remember backup, backup, backup...

Roy-Vidar
 
BlackBearDude said:
No references are shown as MISSING.
Why do I not have any confidence in that statement? The evidence, and the fact that copying only a subsection of application did not reproduce the error, suggest a missing reference.

But given the facts at hand ...

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top