How to change the background of the Edge browser control in Access 2024

jacky Perpète 216 Reputation points
2026-05-31T08:12:45.3933333+00:00

Hello,
I'm using the Edge browser control in a report to display photos.

The control's background is black.

Depending on the size of the displayed photo, I see black bars appearing in the control's empty spaces on the vertical or horizontal sides of the photo.

There's no option in the properties to change the background color.

How can I change the background color to make it transparent, match the background color of my report, or remove this ?

2026-05-31 10_06_43-Harmonimalia

Microsoft 365 and Office | Access | For home | Windows
0 comments No comments

Answer recommended by moderator
jacky Perpète 216 Reputation points
2026-06-08T09:42:25.5033333+00:00

Hello,

I've taken my testing a step further with the Edge browser control.

I used a report and a form with multiple records.

Here are my latest results regarding changing the background of the Edge browser control in Access LTSC 2024.

Reports in preview mode

In VBA, it's impossible to modify the content of the HTML file and see the effects on subsequent records in the report events. The browser control always keeps the first HTML file in memory and sometimes crashes Access.

The method used for the test was to create an HTML file with a different name containing the image and background color for each record.

The HTML file paths are placed in a table field. This field is linked to the browser control's source code.

For another application, I used a different method because I only had one image to display for a single record.

My HTML file is created on demand for the report view, with a different name each time.

The file name is stored in a 'TempVars' variable, which are native Access temporary variables designed specifically for direct access by queries.

In my report query, I created a calculated field that concatenates the HTML file path and its name.

This field is linked to the browser control's source control.

These two principles work perfectly.

The only problem is the slower report display time.

Forms

The only solution that works correctly and quickly is using the 'ExecuteJavaScript' method with the creation of a style (CSS) to define the design and visual presentation of a web page, including the image file transformed into a binary array with the desired background color.

All other solutions fail when scrolling through records. Only the first image remains displayed.

Please find my test application attached.

Due to site restrictions, you must rename the TestNvEdge.txt file to TestNvEdge.zip in order to use it.

Best regards.

TestNvEdge.txt

Was this answer helpful?


4 additional answers

Sort by: Newest
  1. jacky Perpète 216 Reputation points
    2026-06-06T08:13:52.4933333+00:00

    Hello,

    Here are my latest tests regarding changing the background of the Edge browser control in Access LTSC 2024.

    Due to the poor image quality displayed in reports, my primary goal was to be able to display images of acceptable quality in a report preview using the Edge browser control.

    During testing, I noticed that the background color of the control was black and that it was not possible to change it via a property.

    For testing purposes, a 120KB image is used.

    The image filename is stored in a table.

    Reports in Preview Mode

    The browser control in reports presents some problems.

    1. In a report, it is impossible to modify the control's source property.
    2. Using document loading methods such as 'Navigate' and 'ExecuteJavaScript' crashes Access.
    3. Access misinterprets the concatenation of the browser control's source property value. For example, adding the application path to the image path.

    Since VBA methods for loading HTML documents are prescribed, an HTML document is created and saved, for example, in the report's 'Load' event, with the desired image and background color.

    The HTML document is loaded from the source control value that contains the path.

    To work around the problem of misinterpreting the concatenation of the source control value, I used a query with a calculated field that concatenates the HTML file name and the current Access application folder.

    This calculated field is the value of the browser control's source control.

    Forms

    Four solutions were considered for forms.

    1. Image Hiding Solution

    The image is loaded from the source control value containing the path.

    The browser control is hidden by reducing its size.

    The document's background color is then changed using the 'ExecuteJavaScript' method.

    The browser control's size is then increased.

    Note: We use the reduced size rather than the 'Visible' property of the browser control to be hidden because if Visible=False, the image is not loaded.

    2. HTML Document Creation Solution

    Using VBA code, we create an HTML file containing the desired background color and the image.

    The image path must be preceded by the security prefix.

    The HTML file is then loaded into the browser control using the 'Navigate' method.

    3. CSS Style Creation Solution

    Using VBA code, the image is transformed into a base64 binary array.

    A CSS style is then created to define the design and visual presentation of a web page that includes the image file transformed into a binary array with the desired background color.

    The 'ExecuteJavascript' method executes JavaScript within the browser control.

    Note: This approach avoids the need to manage security prefixes.

    Since no physical file is called by the browser, the code works universally across all versions of the application.

    4. Solution Using a Default HTML Document

    Using VBA code and the 'Navigate' method, an HTML file with a white background and no image is first loaded. Next, using the 'ExecuteJavaScript' method, we modify the backgroundColor element to define the desired background color and the img element to insert the image.

    In conclusion:

    For display purposes, creating a style (CSS) with the image as a binary array is the fastest solution.

    The masking solution is the slowest.

    You will find the various forms and the test report in the attached file.
    Due to site restrictions, you must rename the TestNvEdge.txt file to TestNvEdge.zip in order to use it.

    Yours sincerely.

    TestNvEdge.txt

    Was this answer helpful?

    0 comments No comments

  2. jacky Perpète 216 Reputation points
    2026-06-03T03:46:21.5166667+00:00

    Hello,

    After various searches and attempts, I finally have a solution.

    My first approach was to assign the browser's source control to a field containing the image prefix followed by the image path.

    In the VBA code, I hid the control using its size, and after the document fully loaded, I changed the background color using the ExecuteJavascrip method and restored the control's size.

    A few observations:

    I tried concatenating the prefix and the image path in the browser's source control. The value interpreted and displayed in the 'Insert Hyperlink' window is incorrect.

    The prefix is added twice, and the whole thing is enclosed in quotation marks.

    So I used a table field where I add the prefix to the image path.

    Using the Visible property to hide and then show the browser control doesn't work.

    When the visible=false property, the document is not loaded in the control.


    My second solution, using VBA, was to create an HTML document with the desired background color and insert the image into it.

    This document is saved in a directory.

    It is then loaded in the browser.

    This is the only solution I found to bypass the browser control's security with the image.


    After testing, the second solution is the fastest in terms of display.

    You can perform tests using the attached database.
    I've attached the TestNvEdge.txt file, which is the compressed file of my test database.

    I had to use the ".txt" extension due to the site's attachment restrictions.

    You need to change the extension of the TestNvEdge.txt file to TestNvEdge.zip to use it.

    Simply adjust the image paths in the table.

    For the 'MyImageWeb' field, you must leave the prefix before the image path.

    In the form's VBA code, you can adjust the variable Const tempHtmlPath As String = "D:\Documents\Tempo\access_edge_viewer.html", which defines the HTML document created by VBA.

    Yours sincerely.

    My compressed test database:
    TestNvEdge.txt

    TestNvEdge

    TestNvEdge2

    Was this answer helpful?


  3. Anonymous
    2026-05-31T10:39:21.8133333+00:00

    Hello @jacky Perpète

    I recommend referring to the AI response first, as it already provides a useful explanation and is quite aligned with my understanding of the issue.

    However, I also spent some time testing different approaches (including rendering custom HTML, injecting content via VBA), and in my experience these methods are not consistently reliable. In many cases, they still result in a gray or blank area instead of displaying the image.

    User's image

    Because of this, it appears to be an expected behavior, since the Edge Browser Control does not expose any property to control its internal background, and its behavior depends heavily on how the embedded Edge engine renders the content. As a result, based on my testing, there may currently be no reliable way to remove the empty gray/black space, at least using the approaches I have tried.

    I understand this may not be the answer you were looking for, but I hope sharing these findings helps clarify the current behavior. If anyone else has found a more reliable approach, it would be great to learn from that as well.

    Thank you for your understanding.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  4. AI answer

    2026-05-31T08:12:58.6+00:00

    The Edge Browser Control in Access exposes layout and border properties (such as BorderColor, BorderStyle, SpecialEffect, Width, Height, padding, etc.), but there is no property in the documented object model to change the internal page background that appears behind the rendered web content.

    The black bars you see are part of how the embedded Edge engine renders the page/image inside the control. Because the control is effectively a full Edge instance, its background is determined by the HTML/CSS of the page being displayed, not by Access form/report properties. Access can style the control’s border and surrounding layout, but not the internal background that appears when the content does not fill the entire area.

    To change that background color or make it match the report, the only available approach is to change the content being rendered (for example, host the image in an HTML page whose body background matches the report, and navigate the Edge Browser Control to that page). Access itself does not provide a setting to make the Edge Browser Control background transparent or to change those black bars directly.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.