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 / Forms Programming / November 2005

Tip: Looking for answers? Try searching our database.

Command to open file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kathy R - 29 Nov 2005 15:55 GMT
Hello!

I would like to know how to specify a field's contents in a command button.
I'm using Access 2000 here at work.

I have a field 'Program File Name' that I have the full path name to a file
stored.  I have assed a command button to open up the preferred editor for
these file types, and that command works just fine. Now I would like to open
the file specified in the above field. Note: each record has a unique file
specified in the field.

Below is the coding for the Event Procedure:

Private Sub c_OpenCodeFile_Click()
On Error GoTo Err_c_OpenCodeFile_Click

   Dim stAppName As String

   stAppName = "C:\mcamx\common\editors\mastercam\MCXStart.exe"
   Call Shell(stAppName, 1)

Exit_c_OpenCodeFile_Click:
   Exit Sub

Err_c_OpenCodeFile_Click:
   MsgBox Err.Description
   Resume Exit_c_OpenCodeFile_Click
   
End Sub

Thank you in advance for any help! I really appreciate it.
~Kathy
Keith W - 29 Nov 2005 16:44 GMT
> Hello!
>
[quoted text clipped - 9 lines]
> the file specified in the above field. Note: each record has a unique file
> specified in the field.

Couldn't you just use a hyperlink field to store the path in?  No code
required at all and you can store paths to just about any file type and have
the correct application open for free.

Keith.
www.keithwilby.com
Kathy R - 29 Nov 2005 17:06 GMT
Keith -

But wouldn't a hyperlink open the same file on each record? I need to open
unique files for each record.

Plus - I would like to have the option of data entry (file name and path)
into a field rather than emmbedding the info into the design.

Thanks, Kathy

> Couldn't you just use a hyperlink field to store the path in?  No code
> required at all and you can store paths to just about any file type and have
> the correct application open for free.
>
> Keith.
> www.keithwilby.com 
Keith W - 30 Nov 2005 08:54 GMT
> Keith -
>
[quoted text clipped - 5 lines]
>
> Thanks, Kathy

What I was suggesting was having a hyperlink *field* in your table with a
text box bound to it on your form.  Each record would have it's own data in
the field, thus linking it to whatever file the user navigates to.

Regards,
Keith.
www.keithwilby.com
Albert D.Kallal - 30 Nov 2005 16:44 GMT
If you have the path name to the document in a field, then you can "launch"
that file and the correct application will load also.

Just go:

application.FollowHyperlink  me.MyFieldNameWithPathToDocument

So, you don't even have to use the "shell" function.

Signature

Albert D. Kallal   (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.members.shaw.ca/AlbertKallal

 
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.