Hi
The normal way of passing parameters to a batch file is to include them
on the command line and reference them in the file as %1, %2 etc. Is
there some special need to use environment variables that's not apparent
from what you've posted?
Assuming not, then the only "functional" line in the batch file is the
call to Explorer.exe, so all you need is something like this. It assumes
the year is displayed in a textbox on the form called txtYear, and the
project number in txtPrjNum
With Me
Shell "Explorer.exe /E, C:\" & .txtYear.Value _
& "\" & .txtPrjNum.Value
End With
Even if you really need to use a batch file to do cunning stuff you
haven't shown us, pass the data in the Shell() statement. If you want
the same batch file to work from VBA but still to prompt the user for
parameters that haven't been supplied on the command line, use something
like this
@ECHO OFF
ECHO.
SET T1=%1
SET T2=%2
IF !%T1%!==!! SET /p T1="Please enter year: "
ECHO.
IF !%T2%!==!! SET /p T2="Please enter project number: "
>I have a batch file that opens a Windows Explorer window to a path based on
>two typed-in parameters. I would like to add a command button to my access
[quoted text clipped - 22 lines]
> SendKeys "tbl.Project.ProjectYear" {ENTER} "tbl.Project.ProjectID" {ENTER}
>End Sub
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.