Code Help.

P

pfm721

I am adapting some code that will open an outside program when a command
button is pushed. I have sucessfully merged the code into my database. The
button works when I am using it on my computer but I get a path not found
when running it on another computer in the office. If someone could help me
figure out why this is happening I would greatly appreciate it.

The code is as follows.

Private Sub cmdOpenVista_Click()

VistaOpen "~^FEE PATIENT INQUIRY - LOC", Nz(VetSSN, "")

End Sub


Here is the code for the sub routine.

Sub VistaOpen(MenuString As String, SSN As String)
Dim OutputFileName As String
Dim fs, File As Object

If IsBlank(MenuString) Then
Call Shell("C:\Program Files\Esker\SmarTerm\STOFFICE.exe """ &
"C:\Documents and Settings\All
Users\Documents\SmarTerm\Sessions\VISTA.stw""", 1)
Else
OutputFileName = Environ("APPDATA") & "\phi\gostring.rrt"
Set fs = CreateObject("Scripting.FileSystemObject")
Set File = fs.CreateTextFile(OutputFileName, True) <---------
File.WriteLine Replace(SSN, "-", "")
File.WriteLine MenuString
File.Close
MergeIntoFlyer "VISTAVersal"
End If

End Sub

The line with arrow next to it is where the debugger takes me when I get the
error.

Thanks
 
D

Dirk Goldgar

pfm721 said:
I am adapting some code that will open an outside program when a command
button is pushed. I have sucessfully merged the code into my database. The
button works when I am using it on my computer but I get a path not found
when running it on another computer in the office. If someone could help
me
figure out why this is happening I would greatly appreciate it.

The code is as follows.

Private Sub cmdOpenVista_Click()

VistaOpen "~^FEE PATIENT INQUIRY - LOC", Nz(VetSSN, "")

End Sub


Here is the code for the sub routine.

Sub VistaOpen(MenuString As String, SSN As String)
Dim OutputFileName As String
Dim fs, File As Object

If IsBlank(MenuString) Then
Call Shell("C:\Program Files\Esker\SmarTerm\STOFFICE.exe """ &
"C:\Documents and Settings\All
Users\Documents\SmarTerm\Sessions\VISTA.stw""", 1)
Else
OutputFileName = Environ("APPDATA") & "\phi\gostring.rrt"
Set fs = CreateObject("Scripting.FileSystemObject")
Set File = fs.CreateTextFile(OutputFileName, True) <---------
File.WriteLine Replace(SSN, "-", "")
File.WriteLine MenuString
File.Close
MergeIntoFlyer "VISTAVersal"
End If

End Sub

The line with arrow next to it is where the debugger takes me when I get
the
error.


Are you sure that the "\phi" subfolder exists in the %APPDATA% folder on the
computer where it fails?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top