Access Conversion / Runtime error 5 Invalid procedure call

  • Thread starter Thread starter Ed Dolikian
  • Start date Start date
E

Ed Dolikian

I just converted an Access 97 application to Access
XP/2000. I have encountered a specific style of coding
that doesn't work, namely

dim strValue as string
strValue = "ABC"


if not strValue = "ABC" then
(get runtime error '5' invalid procedure call or
Argument on the if not statement
....
else
....
end if



if not strcomp(strvalue,"ABC",vbTextCompare) = 0 then

works.

Do I have to change "ALL" my code? Any ideas?
 
It may be just an issue with not having the correct references set in the
converted db. Open the database using the shift key to bypass any startup
procedures. Open the VB Editor. Open Tools | References and note if any
references show Missing: If so, locate the missing reference from the list
below and check. Close the dialog box and Issue a Debug Compile on the
database. If successful then you should not receive the error as stated
below. If after setting the reference you still receive the error; the code
used under 97 did not convert correctly for the new Access version. This
will require modifying the code to Access 2000/2002 standards.

Note: Access 2000/2002 defaults to ADO; Access 97 run under DAO 3.51.
Setting the reference to use DAO 3.6 and removing any reference to ADO 2.1
or higher may solve your problem.
 
That syntax of:
if not strValue = "ABC" then

That should work fine. You have something else wrong here here.

I MAKE SURE you put a option explicit in each module. a2000 and later DOES
NOT by default put a option explicit in each module for you. (you can change
this default in the tools->options menu..and you SHOULD DO THAT right now).

The above setting will NOT effect your existing modules. So, put a option
explicit in, and do a save and "compile all" to find the errors.

However, that "not" syntax should work just fine.
 
Back
Top