stAppName Command

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What's wrong with this line, File not file. I know this has to be so easy...

stAppName = "C:\Customers\ & Me.CustomerID" & "MerchantApplication.tif"

I have a folder in C named Customers. Their CustomerID from the table, I
want that to be their folder name, like 1998 in Customers Folder and in that
folder, a specified file name / file.

Thanks
Curtis
 
Hi Curtis,
You have a quote in the wrong place:
stAppName = "C:\Customers\" & Me.CustomerID & "\MerchantApplication.tif"
 
Didn't work, keep saying "Invalid Procedure Call or Argument".

Here's what I have, didn't work...


Private Sub Command618_Click()
On Error GoTo Err_Command618_Click

Dim stAppName As String

stAppName = "C:\Customers\" & Me.CustomerID & "\MerchantApplication.tif"
Call Shell(stAppName, 1)

Exit_Command618_Click:
Exit Sub

Err_Command618_Click:
MsgBox Err.Description
Resume Exit_Command618_Click

End Sub
 
I even tried:


stAppName = "C:\Customers\" & Me.CustomerID & "\" &
"MerchantApplication.tiff"
 
Try adding:

stAppName = "C:\Customers\" & Me.CustomerID & "\MerchantApplication.tif"

If Dir(stAppName) = vbNullString Then
MsgBox "Cannot locate [" & stAppName & "]"
End If

Call Shell(stAppName, 1)

Are you just trying to have your picture viewer pop up and show a picture?
 
Nope, same error. It looks like it is because my file isn't a exe file type,
etc. Any other ways to do it?

No, it is an application, many files. I actually use efax.com's program to
manage the pages, but convert to tiff as well for future compatibility or
ability to open the files up if efax's doesn't exist in the future.

Curtis
 
Assuming the ampersand is being used to join strings, it should be this:

stAppName = "C:\Customers\" "& Me.CustomerID" & "MerchantApplication.tif"

Bob
 
Curtis,
I'm pretty sure with the Shell() function you need to specify the application
to use to open the tif file.

I just tried:

Application.FollowHyperlink stAppName

and it works!
 
Hi Curtis,
It looks like it is because my file isn't a exe file type ...

Correct. The Shell program runs an executable program and returns a Variant
(Double) representing the program's task ID if successful, otherwise it
returns zero. Your stAppName variable does not evaluate to the name of an
executable program.

Try the procedure shown below. Add a break point to the line of code that
reads:
Application.FollowHyperlink stAppName

Click on your command button. Open the Immediate Window (Ctrl G), and
inspect the results. Are you seeing a valid path that points to your file? If
so, you should be able to copy the output shown in the Immediate Window, and
paste it into the Start > Find > Files or Folders dialog, and it should find
the file in question. If not, make the necessary adjustments. When finished,
either comment out the Debug.Print statement, or delete it.


Option Compare Database
Option Explicit

Private Sub cmdDisplayImage_Click()
On Error GoTo ProcError

Dim stAppName As String

stAppName = "C:\Customers\" & Me.CustomerID & "\MerchantApplication.tif"

Debug.Print stAppName

Application.FollowHyperlink stAppName


ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in cmdDisplayImage_Click event procedure..."
Resume ExitProc
End Sub



Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
Doing Tiff files are ok, but when I do a file with .efx file ext, it pops up
asking this. Is there some code I can copy some where to disable that pop up?

Some files can contain viruses or otherwise be harmful to your computer. It
is improtant to be certain that this file is from a trustworthy source.

would you like to open this file?
 
This is probably too easy, but if I wanted another cmd to point to their
folder, what would I need to change?
 
Hi Curtis,

I'm getting that nag box even with .tif files. I just didn't mention it.
Short answer is I don't know how to disable it. Instead of opening the image
with an external application, you might try using a form with an ImageFrame
control instead. An example is provided by Access MVP Arvin Meyer. Check out
his PictureMgr sample available here:

http://www.datastrat.com/DataStrat2.html


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
Back
Top