Access 2010: Shared images

Today’s guest writer is Ric Lewis--PM in charge of publishing to SharePoint, Web Services, and Shared Resources.

Traditionally in Access, images have been bound to individual objects on a form or report. Then, if you wanted to change the image for a group of controls across multiple forms and reports, you’d have to go through each control, one by one, and change the image. Some people figured out you could use sub-forms for logos but this wasn’t helpful for images on buttons and background resources.

We also considered the right way to build web forms. One common technique when building web apps is to cluster images together and reuse them as much as possible. Each request the browser has to make to the server is additional overhead that slows down page renders. Browsers are much faster at fetching data out of the cache than from a web server that might be 1/2 way around the world.

Access 2010 introduces the Image Gallery to make it easier to manage and share your resources throughout your database with the added benefit of faster page loads in the browser. Let’s look at an example…

Adding an image

Here is the Assets template in Access 2010. Let’s go to the AssetDetails form and add some branding to the header:

image

Let’s start by looking up in the design area.

image

You’ll notice that the image control is missing from the controls list. While we allow image control types in Client DBs, this is a web database and it uses the new Image Gallery exclusively for handling images in your database. You’ll also notice that the gallery is already populated with images we’ve used in creating the Assets template. But we want to add a new image as a header for this form.

We’ll click “Browse” on the bottom of the gallery. This will allow us to select a new image. It will then drop back to the form to allow you to add the new image control. Let’s drop it just left of our title, and then resize it to our liking.

image

 

Over on the property sheet, the “Picture” property shows a drop-down containing all of our available images that you can assign to that object. Clicking the ellipses for that property will allow you to load another image into the Image Gallery.

image 

Changing an image

I’m fond of my new branding image, so I add it multiple forms and reports. But after showing the work to my client, I’m told that I need to use the new corporate logo throughout the database. So, let’s go in and update that image.

Open the Image Gallery and right-click on the image you need to update, and select “Update”. You can also use the contextual menu to rename or delete an image from the Image Gallery.

image

After that, just select the new image in the file browser, and voila! All the instances of that image in your database have been changed to use the new image!

image

Enjoy!

Office Blogs Comments

Comments: (10) Collapse

  • While this seems to be a little girly, like a friend told me once. . . This is a very important feature. . Imagine updating one app that has been in production for some years, and the app has over 100 forms or reports. . Imagine going one by one. . Thanks Guys for this new update. . Edwin

  • Am I right in thinking we can use this in a client form in a web database, but not in a client form in a standard database? I can't find it in a client form in a standard database? Is that because it needs a sharepoint site to host the images? Alan PS It looks good.

  • This feature works for both web and non web based systems. Remember we’ve always been able to embed pictures in the past. We just never had some type of interface that lets as browse and look at existing imbedded pictures. In client applications, you can drop a picture control on a form, and then manually go to the property sheet and select Shared and then picture property name becomes a combo box that simply lists the available pictures in the application. (the screen shot above shows this). You can also use the insert image button from the ribbon and it pops up a graphical gallery (as opposed to the text combo box list of pictures). When you select a picture from the graphical gallery, then the picture control is inserted on the form with Shared + the combo box set correctly in the pictures property sheet. So dropping the picture control from the ribbon toolbox, or selecting the new insert picture button (beside the ribbon tool box) results in the SAME settings for that image control on the form. So, there is not two image controls here. It just a nice interface and using the ribbon option makes it really convenient to select a graphical image since it displays a graphical gallery. So yes this works for client VBA applications. It’s a simple brilliant design that exposes the embedded pictures we’ve had for years in access. And, this design means that you don’t have a picture inserted again over and over for 20 different forms. It means there is only ONE copy. I In 2007 the image control fixed the imbedded picture bloating problem. This just takes this to the next level and allows one to select and share any picture that’s imbedded in the application. So this is a wonderful benefit for access developers building desktop applications or web applications. Albert D. Kallal

    Edmonton, Alberta, Canada

  • This is a supper feature, my current Access Databases heavily utilize images to jazz up the screens & reports to make them look more professional. As the results in the past my DBs with the images bloat up the size so quickly. This will sure make my future apps slim and easier to work with. Great job Access team!

  • @Alan, the images are stored in your database, so you don't need a SharePoint site to host them. In a client form (whether a client form in a web database or a client form in a client database), you will see the traditional image control, which continues to insert an image in the way 2007 did--embedded by default. However, you'll also see the new Image Gallery, which always inserts a shared image. @LV, when you move to 2010 it will be easy to transition embedded images to the new shared model. Click on the image control in design view and change the Picture Type from Embedded to Shared. A new shared image will be created from your embedded image, which you can then apply to all the controls that use the old embedded image.

  • Very nice, good improvement. Will the gallery be exposed in VBA to add/edit/remove images?

  • Can the gallery also be used for background textures for forms or reports?

  • Jonathan wrote "@Alan, the images are stored in your database, so you don't need a SharePoint site to host them. In a client form (whether a client form in a web database or a client form in a client database), you will see the traditional image control, which continues to insert an image in the way 2007 did--embedded by default. However, you'll also see the new Image Gallery, which always inserts a shared image." Yes, it's there. Don't know how I missed it. Am picking my new specs Monday 22nd 10 a.m.

  • Hi there... I have read a couple of your postings and they are amazingly helpful... however I am facing an issue with forms and subforms backgrounds and PNG images. My current problem is this... I have a form that loads a subform as part of its content. The main form has a background and the subform has some images (PNG images). I need to set the background of the subform to a 50% transparency level; so the background of the main form can be seen through the subform. This is mainly for presentation purposes, I used the code you provided on your transparency posting, but that sets the entire form to transparent and it cannot be used with subforms loaded inside a main form. LOL I hope I manage to explain myself... if you know a way to set the background and only the background of a form to transparent, even when loaded inside other form, I would greatly appreciate that. Thank you again. Nathaniel

  • @OpenGate Yes, there are object model calls that act on the collection of images stored in the database. You won't be able to edit existing images, but you'll be able to add new ones or delete existing ones, which can be combined to give the effect of editing. If you have a copy of the 2010 beta, look at the CurrentProject.Resources collection (from which images can be enumated and removed) and the CurrentProject.AddSharedImage method. @Gilad Yes, you can use a shared image almost anywhere you can use an embedded image, including as a form or report background image.

Comments

Comments: (loading) Collapse