Asked by:
command line with ".src" does not work

Question
-
Have an Access form with two controls, one is an ActiveX named ActiveXCtl1, the other is a command button named ViewPDF
I always get an error "Object doesn't support this property or method" on the line: Me.ActiveXCtl1.src = FilePath
Private Sub ViewPDF_Click()
Dim FilePath As String
FilePath = "C:\Users\MaxineNew\Documents\USW Test.pdf"
Me.ActiveXCtl1.src = FilePath
End SubThe list of ActiveX controls shows this:
I selected "Adobe PDF Reader: But the ActiveX initially showed these properties:
I manually changed it to these properties:
What is WRONG????
Tuesday, November 5, 2019 7:09 PM
All replies
-
Does it work if you leave it the way it was initially?
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_ProfessionalsTuesday, November 5, 2019 10:36 PM -
No. It does not work that way either.Wednesday, November 6, 2019 6:10 PM
-
Just as a test, rename your PDF without the Space so the path becomes
FilePath = "C:\Users\MaxineNew\Documents\USWTest.pdf"
Does that work by any chance?
Or
FilePath = Chr(34) & "C:\Users\MaxineNew\Documents\USWTest.pdf" & Chr(34)
You could also try using
Me.ActiveXCtl1.LoadFile ("" & FilePath & "")
Daniel Pineault, 2010-2019 Microsoft MVP
Professional Support: http://www.cardaconsultants.com
MS Access Tips and Code Samples: http://www.devhut.net
- Edited by Daniel Pineault (MVP)MVP Thursday, November 7, 2019 3:15 PM
Thursday, November 7, 2019 3:12 PM -
I should also add that the Adobe PDF Reader ActiveX is old and unreliable, thus it isn't a good idea to use it anymore.
Why not simply open the PDF using Application.FollowHyperlink (or Shell, ...)?
Daniel Pineault, 2010-2019 Microsoft MVP
Professional Support: http://www.cardaconsultants.com
MS Access Tips and Code Samples: http://www.devhut.netThursday, November 7, 2019 3:42 PM