We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Help with Application.FollowHyperlink in Access
_Andy_
Posts: 11,150 Forumite
in Techie Stuff
Hi
I'm trying to have a button on a form which then opens a PDF file.
I have made a text field (Test) which has the full path on a shared drive to the PDF.
I've tried
Application.FollowHyperlink Test
But the button doesn't do anything.
If I change it to
Application.FollowHyperlink "Thepathname"
It opens the file, so it can't be the path/file name being wrong in the actual data.
Any ideas?
Thanks
PS Using Access 2003
I'm trying to have a button on a form which then opens a PDF file.
I have made a text field (Test) which has the full path on a shared drive to the PDF.
I've tried
Application.FollowHyperlink Test
But the button doesn't do anything.
If I change it to
Application.FollowHyperlink "Thepathname"
It opens the file, so it can't be the path/file name being wrong in the actual data.
Any ideas?
Thanks
PS Using Access 2003
0
Comments
-
Should have put - it doesn't do 'nothing' - it opens up an address bar (with the database location filled in) for some reason.0
-
*bump* - still haven't been able to fix it.0
-
Am not an expert on Access - have phaffed with it a litte from time to time .
Have you got the latest acrobat?
Is the pdf in the same location as the access file?
It might be invoking acrobat and closing it without you noticing?0 -
try
[TextBoxObject].SetFocus
Application.FollowHyperlink ([TextBoxObject].Text)
ie
Form_Form1.Textbox0.SetFocus
Application.FollowHyperlink(Form_Form1.Textbox0.Text)
Works on Access 07, usual stuff like macros must be enabled etc.0 -
Rob
Not sure if I'm doing this right but I'm getting runtime errors
I've put
"Private Sub Command83_Click()
Form_Form1.Command83.SetFocus
Application.FollowHyperlink (Form_Form1.Command83.test2)
End Sub"
On a command button, i.e. command83 is the name of the button
test2 is the name of the field that holds the file path and name. I used right click > build event > code builder.
It's highlighting "Form_Form1.Command83.SetFocus" line as being wrong?
Thanks0 -
Also tried
Application.FollowHyperlink Me.Test2
Which would be nice and simple but I get
"Compile error:
Method or data member not found"0 -
Fixed - I used
Private Sub Command84_Click()
Dim TestStr As String
TestStr = [FieldName]
Application.FollowHyperlink TestStr, , True, True
End Sub
Works very nicely
0 -
for various reasons which im not quite sure about, if you want to access a member of an object on a form it needs to have focus.
(im going to assume the field is populated into a textbox object)
so you'll need to do
me.Test2.SetFocus 'This gives the field focus and will allow you access the value of the field
Application.FollowHyperlink (me.Test2.Text) ' gives the VALUE of Test2 to the function
You can't do Me.Test2 because its just an object you need to access on of its members (in this case .text) to get any info or functionality from it.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 352.2K Banking & Borrowing
- 253.6K Reduce Debt & Boost Income
- 454.3K Spending & Discounts
- 245.2K Work, Benefits & Business
- 600.9K Mortgages, Homes & Bills
- 177.5K Life & Family
- 259K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards