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 / August 2005

Tip: Looking for answers? Try searching our database.

open a adobe file from a command button with access

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
open a adobe file from a command button - 27 Jul 2005 02:11 GMT
I have 4/5 thousand adobe files in a directory, after selecting the one I
want from a combo box I want to click a command button that says "View
Document".  Each document has its own number, 0001, 0002, 3435...  What I
don't know how to do is write the code to open adobe and direct it to the
directory and the number.  I think this is for an advanced coder (not me) but
I would like some help, please!!!
Allen Browne - 27 Jul 2005 02:36 GMT
You can use FollowHyperlink to open the document in the program registered
to handle that type.

This is an example of the event procedure (code) to use. It assumes the
combo named MyCombo contains the number, and you need to add the path name
and the .pdf extension.

Private Sub OpenDoc_Click()
   Dim strDoc as String
   If Not IsNull(Me.MyCombo) Then
       strDoc = "C:\MyFolder\" & Me.MyCombo & ".pdf"
       FollowHyperlink strDoc
   End Sub
End Sub

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have 4/5 thousand adobe files in a directory, after selecting the one I
> want from a combo box I want to click a command button that says "View
[quoted text clipped - 3 lines]
> but
> I would like some help, please!!!
open a adobe file from a command button - 28 Jul 2005 06:12 GMT
Allen, Hi.  Thanks for the help with my problem.  I am over my head in what
I’m trying to do because after entering your code I get an error on
“hyperlink follow”.  Because I’m in over my head I decided to send you what I
did in hopes you can help me fix this.  

Private Sub Command10_Click()
Dim xx As String
Dim strDoc As String
xx = Me.VaultNo
MsgBox "No is " & xx

   If Not IsNull(Me.Command10) Then
      strDoc = "E:\Access\Temp\" & Me.VaultNo & ".pdf"
     FollowHyperlink strDoc
   End If

MsgBox "Str= " & strDoc
End Sub

Each document has a number, 1-3678.   Each document has a name.  I use the
combo box to let the person select by title, the document they want to see.  
I store the number of that document in xx.  I added your code and then added
a message box  to see if I was getting the correct name of the document in
E:\access\temp.  I am, but it errors out on followhyperlink strdoc and my
understanding of VBA is only 1 course deep.  I should have played with
something easy!!!

Thanks

> You can use FollowHyperlink to open the document in the program registered
> to handle that type.
[quoted text clipped - 18 lines]
> > but
> > I would like some help, please!!!
Allen Browne - 28 Jul 2005 06:42 GMT
The idea looks right, except you need to test if the VaultNo text box is
null, not if the command button is.

What error message do you receive?
If 490, the name might be incorrect.
Do you need to use Format() to add leading zeros to the name?

Does Dir(strDoc) return the right name, or a blank (indicating that the
document does not exist)?

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"open a adobe file from a command button"
<openaadobefilefromacommandbutton@discussions.microsoft.com> wrote in
message
news:410FE046-7FC9-4B42-BB9E-EADCDB2557CE@microsoft.com...

> Allen, Hi.  Thanks for the help with my problem.  I am over my head in
> what
[quoted text clipped - 61 lines]
>> > but
>> > I would like some help, please!!!
open a adobe file from a command button - 29 Jul 2005 03:14 GMT
Hi Allen.  I was testing for "VaultNo', that did not work so I put in the
command button (I'm reaching now).   It is a '490' error but I'm getting back
expected results.  VaultNo = 1, strDoc returns "E:\Access\Temp\1.pdf, but the
error says "cannot open this file.  I have Adobe on my box and the file opens
correctly when I go to the directory and click on it.

> The idea looks right, except you need to test if the VaultNo text box is
> null, not if the command button is.
[quoted text clipped - 71 lines]
> >> > but
> >> > I would like some help, please!!!
Allen Browne - 29 Jul 2005 03:33 GMT
Open the Immediate window (Ctrl+G)

Type:
   Dir("E:\Access\Temp\1.pdf")
and press enter.

If you get no response, the file name is not correct.
If you do get a response (the file name), then try this in the Immediate
window:
   FollowHyperlink "E:\Access\Temp\1.pdf"

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"open a adobe file from a command button"
<openaadobefilefromacommandbutton@discussions.microsoft.com> wrote in
message
news:3F454EE1-B360-4BF2-A8B8-38FDDB18B3DD@microsoft.com...

> Hi Allen.  I was testing for "VaultNo', that did not work so I put in the
> command button (I'm reaching now).   It is a '490' error but I'm getting
[quoted text clipped - 93 lines]
>> >> > but
>> >> > I would like some help, please!!!
open a adobe file from a command button - 30 Jul 2005 02:48 GMT
Allen, Hi.  I put it in exactly as you said and I got nothing.  I entered
dir("C:\program Files\Modem helper\english").  I got nothing here also, yet
this document is in this directory

> Open the Immediate window (Ctrl+G)
>
[quoted text clipped - 104 lines]
> >> >> > but
> >> >> > I would like some help, please!!!
Allan Murphy - 30 Jul 2005 08:06 GMT
You are missing the file extension ---
try    dir("C:\program Files\Modem helper\english.pdf").

--
Allan Murphy
Email: allanmurphy@unwired.com.au
> Allen, Hi.  I put it in exactly as you said and I got nothing.  I entered
> dir("C:\program Files\Modem helper\english").  I got nothing here also, yet
[quoted text clipped - 117 lines]
> > >> >> > but
> > >> >> > I would like some help, please!!!
open a adobe file from a command button - 03 Aug 2005 02:22 GMT
Allan, Hi.  Wanted to thank you very much for leading me in the right
direction.  As I continue in Access I will be posting more questions so
please feel free to respond!  Here is the solution.

Dim strdoc As String
On Error GoTo errorhandler

if Not IsNull(Me.[Vault No]) then
strdoc = "F:\common\Offsites\Images\"&Me.[Vault No].Value & ".pdf"
FollowHyperlink strdoc
End If

errorhandler:
MsgBox "No Document"

> You are missing the file extension ---
> try    dir("C:\program Files\Modem helper\english.pdf").
[quoted text clipped - 144 lines]
> > > >> >> > but
> > > >> >> > I would like some help, please!!!
Allan Murphy - 27 Jul 2005 08:06 GMT
Another option to allen's solution is

Coding that I use to open an user's guide in a pdf format

Sub user_guide_general()
' short guide for general users
Dim app_name As String

app_name = "c:\program files\adobe\acrobat 5.0\reader\acrord32.exe
j:\common\databases\general guide.pdf"

Call Shell(app_name, 1)

End Sub

"c:\program files\adobe\acrobat 5.0\reader\acrord32.exe  is where the
acrobat reader exe file resides

j:\common\databases\general guide.pdf is the location of the PDF file.

--
Allan Murphy
Email: allanmurphy@unwired.com.au
> I have 4/5 thousand adobe files in a directory, after selecting the one I
> want from a combo box I want to click a command button that says "View
> Document".  Each document has its own number, 0001, 0002, 3435...  What I
> don't know how to do is write the code to open adobe and direct it to the
> directory and the number.  I think this is for an advanced coder (not me) but
> I would like some help, please!!!
 
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.