View Full Version : run time error 5


adaniele
04-15-2007, 05:31 PM
hi guys.
i am trying to run a batch file from access.
Dim RetVal
RetVal = Shell("c:\winedb\email.bat", 1)

i am getting the following error msg.
"run-time error 5
invalid procedure call or argument"

Could u pls hlp me..thx, max.

BrettStah
04-15-2007, 05:56 PM
hi guys.
i am trying to run a batch file from access.
Dim RetVal
RetVal = Shell("c:\winedb\email.bat", 1)

i am getting the following error msg.
"run-time error 5
invalid procedure call or argument"

Could u pls hlp me..thx, max.

Try this:
Dim RetVal
RetVal = Shell("cmd.exe /c c:\winedb\email.bat", 1)

adaniele
04-15-2007, 06:05 PM
brettstah,
thx very much 4 your hlp and time.
i forgot to tell you that i am working in a citrix environment. so, your code opens the command prompt and look for the bat file in citrix. But the bat file is in the user's oc.

thx, max.

BrettStah
04-15-2007, 06:07 PM
brettstah,
thx very much 4 your hlp and time.
i forgot to tell you that i am working in a citrix environment. so, your code opens the command prompt and look for the bat file in citrix. But the bat file is in the user's oc.

thx, max.

Does Citrix map a drive, such as V:, for the user's C: drive? Can you put the batch file on a network share, and then use a UNC path (or known pre-existing drive mapping)?

adaniele
04-15-2007, 06:13 PM
i can not put it on the net......
is there any other way to run the bat file from access apart from the shell or call shell?
thx, max.

BrettStah
04-15-2007, 06:28 PM
i can not put it on the net......
is there any other way to run the bat file from access apart from the shell or call shell?
thx, max.

If I understand your problem, your users are running Access via a Citrix session, and you want to have a batch file on the users' C: drive be executed. If so, you may be in luck, if your users' C: drives are mounted as a known drive letter from within the Citrix sesson - V: is commonly used for this.

adaniele
04-15-2007, 07:13 PM
brettstah,
i dont think i am lucky.
The citrix hard disks are X and W. The user's hard disk are always C and D
thx, max.

BrettStah
04-15-2007, 07:39 PM
brettstah,
i dont think i am lucky.
The citrix hard disks are X and W. The user's hard disk are always C and D
thx, max.

Just to verify, when you log into one of the Citrix servers and open up 'My Computer', do you see a V: drive mapping?

adaniele
04-15-2007, 07:39 PM
brettstah,
i am almos there. I could finally know it is not running .
I am using your suggestion..."shell ("cmd.exe /c....")
before the cmd windows closes i can see an error msg.
ACCESS DENIED
Do u know how can i solve this?

thx, max.

BrettStah
04-15-2007, 07:42 PM
brettstah,
i am almos there. I could finally know it is not running .
I am using your suggestion..."shell ("cmd.exe /c....")
before the cmd windows closes i can see an error msg.
ACCESS DENIED
Do u know how can i solve this?

thx, max.

You can temporarily change the "/c" to "/k" to force the command window to remain open. Maybe there is some additional information that can help lead to a solution.

adaniele
04-15-2007, 07:58 PM
brettstah,
thx very much 4 your hlp. at this point all i can read is access denied when the batch file trys to open the access db which is in the users pc.

by the way, the bat file opens a db in the users pc.

thx, max.

BrettStah
04-15-2007, 08:03 PM
brettstah,
thx very much 4 your hlp. at this point all i can read is access denied when the batch file trys to open the access db which is in the users pc.

by the way, the bat file opens a db in the users pc.

thx, max.

So you are trying to run the code with the Shell function from an Access database that is run via Citrix, and it is calling a batch file that is supposed to open another database on the users' PCs?

adaniele
04-15-2007, 08:09 PM
brettstah,
lets start from the beginning. i have a db in citrix. When a user make a specific transaction , the db inserts a record in a db located in the users pc.
this dummy db creates a document for this transaction and sends it via email using the users outlook or lotus notes.
The problem is that i dont want to have the dummy db running all the time. i want to open it only when the user needs to send the email.
I know i could use smtp, but my supports dont wanna hlp me at all. so this is my workaround.
I could schedule the bat file to run a few times a day, but if the network pwd is changed the user must remember to change the schedule settings too (they are not that good).

thx again, max.