title: Load Picture to Microsoft Access 2010 Ribbon from Table
body: <p>I'm working with Access 2010's new ribbon feature, and I'm trying to figure out the simplest way to load an image to the ribbon from a table. I know that I could do this by using a GDI API function, but from what I can see the code looks convoluted and appears to utilize extra dlls that I would just as well avoid calling if I don't need to. I also know that I could create a control on a form, load the image to the form, and then load the image from the form to the ribbon image variable. While using the form is doable, it seems sloppy. Eventually, I will resort to one of the two preceding methods if I have to, but it just seems like there should be some simple way to load an image from a table directly into an image variable for the ribbon.</p>
  
  <p>One thing to note is that I'm willing to use whatever image format is easiest. These icon files are very small and so I'm not concerned about file size and I also don't care whether or not they are capable of transparency. So if there's a method that only works with bitmap file types that is fine with me.</p>
  
  <p>Here's the code I have for the button in the ribbon XML: </p>
  
  <pre><code>&lt;button id="CCTrans" label="Credit Card Trans." getImage="GetMnuIcn" onAction="=OpenCCTrans()" /&gt;
  </code></pre>
  
  <p>And here's the code I have for retrieving the image:</p>
  
  <pre><code>Sub GetMnuIcn(control As IRibbonControl, ByRef Image)
      Set Image = DLookup("Img", "LtblImg", "Lbl=""" &amp; control.ID &amp; """")
  End Sub
  </code></pre>
  
  <p>I've tried storing the image both as an OLE Object and as an attachment. Either way, when I try to retrieve it, it gives me the error "Type Mismatch". For simplicity, I've been storing it as a bitmap, but I also tried .gif and .png in my first attempts.</p>
  
  <p>Note: Apparently the ribbon icons are IPictureDisp objects. If I can just figure out how to load an image from a table into one of those object types, I should be able to use it for the ribbon.</p>
  
  <p>Also, there's a lot of good information on Microsoft's website, but I haven't been able to piece it together into a solution yet. Here's a link: <a href="http://msdn.microsoft.com/en-us/library/bb187398.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb187398.aspx</a></p>