Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    NY
    Posts
    3

    Red face Unanswered: case statement causes run time error 5 on one particular machine

    Hi all,

    I have a VBA program that works fine on all machines except one. On this particular machine, a number of case statements would cause a run time error 5, invalid function parameter or argument. I'm very certain that all the constants and variables involved are defined properly. And I don't see why it would be invalid parameter since it's just a Case statement, I'm not calling any function.

    I suspect it has something to do with the settings on the machine. But I'm unfamiliar with either Access or Visual Basic. I was told to check the References in Visual Basic. So I compared the references used on the problem machine with other machines that work, and even though there are differences, none of the differences is isolated only to the problem machine. So it did not help much.

    Being new to all these stuff, I really need some expert's help. Really appreciate it. Thanks!

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    You are using a function. It is called "Select Case". It is a Microsoft function that is stored in dll's. Make sure that all dll's (in your references) are the same as one of the machines that works. As well, I often (once or twice a year) have to copy dll's and OCX's over top of "upgraded" versions that do not show up in the reference. Sometimes the problem manifests itself in an error that the function Date is not available. I don't know which dll or ocx has the Select Case function, but some one else might. Do you have a setup program for your database?

  3. #3
    Join Date
    Jan 2003
    Location
    NY
    Posts
    3
    Thanks for your help! No, I don't have a setup program. I'm trying replacing the library files on the problem machine with the ones on my machine. One of them is VBE6.dll, but i could not replace it because once i do that, Access crashes. (The Access on the problem machine was 2000, then we tried upgrading it hoping it might get rid of the problem. Now it is Access 2003. But it still has the same problem.)

    I'm still trying other libraries, but since it's holiday the person who owns the problem machine is leaving early and I can't continue to try until next week.

    One thing I noticed is that there is also a backup of the VBA program, and I remember it was automatically created by Access when the original VBA program ran into problem (crashed or something). This program has exact the same code as the original program, however its size is different. I haven't figured out what's the different yet. But that program does not have the run time error.

    Now since they are running on the same machine, if a library is linked wrong, why would the backup copy not have the problem? Is there something special that Access does when making a backup copy that affects this?

    I also searched on the web to see in what library is Select Case defined. But I can't seem to find anything that says this is a defined function. It is just a visual basic keyword, and I dunno where that is defined...

    Clueless...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •