Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

stAppName Command

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Curtis Stevens - 30 Oct 2006 22:06 GMT
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
ruralguy - 30 Oct 2006 22:36 GMT
Hi Curtis,
You have a quote in the wrong place:
stAppName = "C:\Customers\" & Me.CustomerID & "\MerchantApplication.tif"

>What's wrong with this line, File not file.  I know this has to be so easy...
>
[quoted text clipped - 6 lines]
>Thanks
>Curtis

Signature

HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Barry Gilbert - 30 Oct 2006 22:42 GMT
Try this:
stAppName = "C:\Customers\" & Me.CustomerID & "\MerchantApplication.tif"

Barry

> What's wrong with this line, File not file.  I know this has to be so easy...
>
[quoted text clipped - 6 lines]
> Thanks
> Curtis
Curtis Stevens - 30 Oct 2006 22:53 GMT
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
Curtis Stevens - 30 Oct 2006 22:56 GMT
I even tried:

stAppName = "C:\Customers\" & Me.CustomerID & "\" &
"MerchantApplication.tiff"
ruralguy - 30 Oct 2006 23:09 GMT
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?

>I even tried:
>
> stAppName = "C:\Customers\" & Me.CustomerID & "\" &
>"MerchantApplication.tiff"

Signature

HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Curtis Stevens - 30 Oct 2006 23:18 GMT
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
ruralguy - 30 Oct 2006 23:43 GMT
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!

>Nope, same error.  It looks like it is because my file isn't a exe file type,
>etc.  Any other ways to do it?
[quoted text clipped - 4 lines]
>
>Curtis

Signature

HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Curtis Stevens - 31 Oct 2006 00:41 GMT
Thanks for all your help!
Tom Wickerath - 31 Oct 2006 00:09 GMT
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
__________________________________________

> Nope, same error.  It looks like it is because my file isn't a exe file type,
> etc.  Any other ways to do it?
[quoted text clipped - 4 lines]
>
> Curtis
Curtis Stevens - 31 Oct 2006 00:43 GMT
Thank you, it worked!  So happy now, you guys helped me concord the world!

Curtis
Tom Wickerath - 31 Oct 2006 00:50 GMT
Good to hear, and good luck on your project.


Tom Wickerath
Microsoft Access MVP

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

> Thank you, it worked!  So happy now, you guys helped me concord the world!
>
> Curtis
Curtis Stevens - 31 Oct 2006 01:45 GMT
This is probably too easy, but if I wanted another cmd to point to their
folder, what would I need to change?

> Good to hear, and good luck on your project.
>
[quoted text clipped - 9 lines]
> >
> > Curtis
ruralguy - 31 Oct 2006 01:57 GMT
You may want to look here:
http://www.mvps.org/access/api/api0002.htm
or here:
http://www.mvps.org/access/api/api0001.htm

>This is probably too easy, but if I wanted another cmd to point to their
>folder, what would I need to change?
[quoted text clipped - 4 lines]
>> >
>> > Curtis

Signature

HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Curtis Stevens - 31 Oct 2006 00:48 GMT
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?
Tom Wickerath - 01 Nov 2006 09:26 GMT
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
__________________________________________

> 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?
[quoted text clipped - 3 lines]
>
> would you like to open this file?
bob - 30 Oct 2006 23:24 GMT
Assuming the ampersand is being used to join strings, it should be this:

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

Bob

> What's wrong with this line, File not file.  I know this has to be so
> easy...
[quoted text clipped - 8 lines]
> Thanks
> Curtis
Curtis Stevens - 30 Oct 2006 23:34 GMT
It says complie error on this??

"& Me.CustomerID"

> Assuming the ampersand is being used to join strings, it should be this:
>
> stAppName = "C:\Customers\" "& Me.CustomerID" & "MerchantApplication.tif"
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.