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
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!!!