Re: On Click Help



It is a valid file. The field ItemNumber1 in my table is a hyperlink field.
When I click this field, it opens the pdf as I want. If I put this on the
dap it shows the hyperlink address. I do not want the users to see or click
on a hyperlink address to open the pdf. I would prefer the command button
like on a regular access form.

Do you know of any other reasons that my prevent it from working properly?

Thanks again for your time and help.
Pam

"Douglas J. Steele" wrote:

That, I just took from your code. I assumed that it worked!

That could well be the cause of your permission problem: myFile didn't
contain a valid file, so the command failed.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"PHisaw" <PHisaw@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E774AB57-6978-4B5D-86A1-C5EAC91090BD@xxxxxxxxxxxxxxxx
I thought so and I tried that and got error msg: Object doesn't support
this
property or method: 'ItemNumber1.Value'

Do you have any other suggestions?

Thanks,
Pam

"Douglas J. Steele" wrote:

My typo. There should be four double quotes at the end of the line, not
just
three. It's three double quotes in the middle.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"PHisaw" <PHisaw@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:16122828-1080-456D-9BE2-9B3872D08E77@xxxxxxxxxxxxxxxx
That gave me Char: 44
Error: Unterminated string constant

Thanks anyway.
Pam

"Douglas J. Steele" wrote:

Sorry, no idea.

Since you said you're trying to open PDF files, you could try:

dim objShell
dim myFile

set objShell = CreateObject("Shell.Application")
myFile = ItemNumber1.value
objShell.Run "acrord32.exe """ & myFile & """
set objShell = Nothing


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"PHisaw" <PHisaw@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:745AFFC7-B511-4763-ACD1-7FFC0914E91C@xxxxxxxxxxxxxxxx
Doug,

Thanks for the reply. I know you said you couldn't help with code
for
the
DAP, but was hoping you wouldn't mind taking a look at some VBScript
that
PaulD from the DAP section gave and is giving me a error. I posted
back
with
the error but have yet to receive a reply. Maybe it is something
you
could
possibly help me with. I'm using the following code on a command
button
and
am receiving a script error on this line -
objShell.ShellExecute myFile, "", "","open", 1

error is "Permission Denied";
char: 1;
code: 0;
URL: accdp://9017264/


Since I am a newbie, I can't quite figure out what I am doing wrong.
Here's
the complete code for button.

<SCRIPT language=vbscript event=onclick for=btnPDF>
<!--

dim objShell
dim myFile
set objShell = CreateObject("Shell.Application")
myFile = ItemNumber1.value
objShell.ShellExecute myFile, "", "","open", 1
set objShell = Nothing
-->
</SCRIPT>

If you could point me in the right direction, I would greatly
appreciate
it.
Thanks for your time and help.
Pam

"Douglas J. Steele" wrote:

Sorry, mental slip on my part. You put Dir, but I read it as Len.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"PHisaw" <PHisaw@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:42F13C4D-50C8-42A5-9D01-0BB35BFA1F0E@xxxxxxxxxxxxxxxx
Doug,

Thanks for the reply. Will you please explain your comment?
" will never be true, since you're hard-coding parts of it."

I'm using this code in a db form now and it opens the pdf's
listed
in
the
field selected. I would like to know if there is something I
should
be
aware
of.

Thanks again,
Pam


"Douglas J. Steele" wrote:

Afraid I can't help you with respect to running that code in a
DAP,
but I
just wanted to point out that it won't work for an MDB.

If Dir(strPath) = "" Then

will never be true, since you're hard-coding parts of it.

You need

Private Sub Command21_Click()
Dim strPath As String

If Len(Me.[ITEM NUMBER] & vbNullString) = 0 Then
MsgBox "There is no pdf for this brochure."
Else
strPath = "\\databases\PDF\" & Me.[ITEM NUMBER] & ".pdf"
Application.FollowHyperlink strPath
End If

End Sub




--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Pam" <pamnospam@xxxxxxxxxxxxxxxx> wrote in message
news:eQUKNyhqIHA.1768@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I have posted a couple of times in the DAP group, but have
received
no
help to question - there is also a lot of ads and testing
posts
there.
I'm hoping someone here can help. I need a command button set
up
on
the
DAP like in a form where you have an "if" statement to open a
pdf
file
located on server that matches file name in text box. This is
code
I
use
on my regular search form, but with DAP being HTML I realize
it
won't
work. This is the last step I need to complete search page.

Any help is greatly appreciated.
Pam

Private Sub Command21_Click()
Dim strPath As String

strPath = "\\databases\PDF\" & Me.[ITEM NUMBER] & ".pdf"
If Dir(strPath) = "" Then
MsgBox "There is no pdf for this brochure."
Else
Application.FollowHyperlink strPath
End If

End Sub
















.



Relevant Pages

  • Re: Required field added to existing records
    ... berupdate and now when I open the form, it opens with "you must add data ... Private Sub Form_BeforeUpdate ... Doug Steele, Microsoft Access MVP ... What else can I do to control this field so that it will flag the ...
    (microsoft.public.access.forms)
  • Re: Word2007 does auto open PDF after Save as command
    ... and it still won't automatically open the PDF when I use the Save as PDF or ... Word MVP web site http://word.mvps.org ... I can categorcially say that PDF Reader opens automatically everytime ... I have also set the default Adobe Reader 9.2 as the default ...
    (microsoft.public.word.docmanagement)
  • Re: Parameter Value??
    ... Doug Steele, Microsoft Access MVP ... (no private e-mails, please) ... there is open time on a job and then the reminder form opens. ...
    (microsoft.public.access.forms)
  • Re: Word2007 does auto open PDF after Save as command
    ... If uninstalling the PDF plug-in then reinstalling it doesn't fix it, ... Word MVP web site http://word.mvps.org ... I can categorcially say that PDF Reader opens automatically ... I have also set the default Adobe Reader 9.2 as the default ...
    (microsoft.public.word.docmanagement)
  • Running into the same problem
    ... Tested another couple PDFs from the same site and it seems they don't open when using a Word 2007 hyperlink either ... PDF open in Internet Explorer showing the Acrobat reader UI ... Hyperlink in Word 2007 showing error message ... opens in Adobe Reader. ...
    (microsoft.public.word.application.errors)