How to remove images stored in access (.accdb)?

Viewed 2535

I'm trying to keep access database size to a minimum and need to remove several large images that previously were used but now aren't needed. My understanding is access files (.accdb) store images inside the database. Do you know if it's possible to remove it and how? TIA

clarification & solution: I had several different forms with different background images, however at this point I have figured it out (for Access 2013) -> under Form Design Tools -> Design -> Insert Image, then right click on the image you need to remove and then click on Delete. Done.

2 Answers

If you want to completely remove all shared pictures in the database, or ones whose name matches a certain pattern you can do something like this:

Sub PurgeSharedImages(Optional strPattern As String = "*")
  Dim i As Integer

  For i = CurrentProject.Resources.Count - 1 To 0 Step -1
    If CurrentProject.Resources(i).Type = 1 And CurrentProject.Resources(i).Name Like strPattern Then 
      CurrentProject.Resources(i).Delete
    End If
  Next i
End Sub
Related