Macro to change the background image of a database form

I have need of a macro to change the background image of a database form.

The current image and the changed-to-image are imported, linked to, bitmaps
so I’m assuming that the macro will need to reset the current URL of the image.

But I’m stuck on how to do it.

Hi

A database form is a text document (supports com.sun.star.text.TextDocument service). So you can do something like that:

LibOForm = ThisDatabaseDocument.FormDocuments.getByName("FormName").open 

sUrl = convertToUrl("C:\Users\UserName\Pictures\Foo.JPG")

oStyles = LibOform.styleFamilies.getByName("PageStyles")
oStyle = oStyles.getByName("Standard")
oStyle.BackGraphicURL = sUrl

Thank you again Pierre for a simple, understandable, succinct answer.