Web browser control doesn't work in Access 365

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Web browser control doesn't work in Access 365

Post by Peter Kinross »

Just changed to 365, so far so good, except:
I have a form that shows a list pf PDFs. Clicking on one displays it in the web browser control in the same form. This has worked for a long time, but with 365, the PDF doesn't display in the control, instead it opens my PDF editor and appears there.
Avagr8day, regards, Peter

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Web browser control doesn't work in Access 365

Post by HansV »

As far as I know the webbrowser control indeed doesn't work in recent versions of Office.
Best wishes,
Hans

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Web browser control doesn't work in Access 365

Post by Peter Kinross »

That's progress!
It was extremely helpful being able to open the PDF in an Access form, extremely helpful.
Any ideas of a replacement technique anyone?
Avagr8day, regards, Peter

robertocm
Lounger
Posts: 43
Joined: 07 Jun 2023, 15:34

Re: Web browser control doesn't work in Access 365

Post by robertocm »

There seems to be a new control, Google for this keywords:
Edge-Based Browser Control Officially Released
Use the Edge browser control on a form
Access: Modern Web Browser Control
The Future of the WebBrowser control and Edge now that IE is going away

"The new Edge-based web browser control for Microsoft Access is now Generally Available for Microsoft 365 versions 2304 and later."

User avatar
Gasman
2StarLounger
Posts: 104
Joined: 22 Feb 2022, 09:04

Re: Web browser control doesn't work in Access 365

Post by Gasman »

Lengthy post, but should provide some insight?

https://www.access-programmers.co.uk/fo ... re.326988/

Post #118 is probably a good place to start?
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Web browser control doesn't work in Access 365

Post by Peter Kinross »

Wow, thanks for all that info. I used all I could find from your posts, however: the code below does nothing, not even inserting the ControlSource string into the EdgeBrowser10.ControlSource. (The old almost identical code did work and did insert the string in the old WebBrowser control.)

Code: Select all

Dim FileRef As String, CtrlRef As String
On Error GoTo Err_lstPDFs_Click
FileRef = Me![lstPDFs].Column(1) & Me![lstPDFs].Column(0)
CtrlRef = "='https://msaccess/" & FileRef & "'"
Debug.Print CtrlRef
Me.EdgeBrowser10.ControlSource = CtrlRef
Me.EdgeBrowser10.Requery
Exit_lstPDFs_Click:
Exit Sub
If I put the string from Debug.Print CtrlRef into the WebBrowser10.ControlSource and then change from design mode to Form mode, it displays the PDF as it should.
The old WebBrowser control opened almost immediately, this one takes a few seconds. But to get the functionality, I can begrudgingly live with that marvellous bit of progress.
Any ideas on how to get the ControlSource string to stick?
Avagr8day, regards, Peter

User avatar
Gasman
2StarLounger
Posts: 104
Joined: 22 Feb 2022, 09:04

Re: Web browser control doesn't work in Access 365

Post by Gasman »

I am not convinced you would use the single quotes here?
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Web browser control doesn't work in Access 365

Post by Peter Kinross »

Neither """", nor """, nor Chr(34) work either. I think I have tried all combinations.
Including with and without https://msaccess/. It did work when I pasted the string into the Property sheet in design mode without the https://msaccess/. So I guess that that isn't needed.
Avagr8day, regards, Peter

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Web browser control doesn't work in Access 365

Post by Peter Kinross »

Brainwave - with the form in Normal mode, open in Design mode, insert ControlSource from code, reopen in Normal mode. More like brain fade than brainwave: can't insert ControlSource from code in design mode.
I am desperately open to ideas on how to get the ControlSource change to actually be entered from code and stick in the EdgeBrowser10 ControlSource.
Avagr8day, regards, Peter

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Web browser control doesn't work in Access 365

Post by Peter Kinross »

Dumped EdgeBrowser - useless piece of MS imagination.
Tried the WebBrowser (WB) control, a bit more success.
Physically placing this line in the WB ControlSource: = [lstPDFs].[Column](1) & [lstPDFs].[Column](0), brings up the correct doc, but in my PDF editor, NOT in the WB control.
Changing the line to: ="https://msaccess/" & [lstPDFs].[Column](1) & [lstPDFs].[Column](0), only brings up the error in the WB control, 'Can’t reach this page'.
Any ideas on how to get the doc to display in the WB control?
Avagr8day, regards, Peter

User avatar
Gasman
2StarLounger
Posts: 104
Joined: 22 Feb 2022, 09:04

Re: Web browser control doesn't work in Access 365

Post by Gasman »

No, sorry. :sad:
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.

User avatar
Gasman
2StarLounger
Posts: 104
Joined: 22 Feb 2022, 09:04

Re: Web browser control doesn't work in Access 365

Post by Gasman »

The browser did not like spaces in the local filenames? You needed to replace with %20, I believe?

Now fixed apparently.
https://www.access-programmers.co.uk/fo ... st-1881653
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Web browser control doesn't work in Access 365

Post by Peter Kinross »

Oh that would be so good. But not sure what you mean. I used FileRef = Replace(FileRef, " ", "%20"), which did what it is supposed to do.
Debug.? FileRef gave E:\My%20Documents\My%20Pape.... Which is what I assume you mean. But using the EdgeBrowser control it did nothing but give an error that read.
Error Cannot find 'file//E/My%2520Documents/My%2520Paper. (It has the %20s replaced with %2520). Using the new Browser control, nothing happened.
Neither control had the control.RecordSource changed, it was still blank for both.
Avagr8day, regards, Peter

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Web browser control doesn't work in Access 365

Post by Peter Kinross »

I did try the Adobe Acrobat Reader control. But I cannot see any way of getting a doc into it. It doesn't have a RecordSource. I will post this as a different topic.
Avagr8day, regards, Peter