The viscosity of some sugars varies continuously by approximately 10 orders of magnitude over a temperature range of 50 degrees C. Sugars are therefore ideal model materials for studying the failure mechanism of materials as they change from the solid to the liquid state. We have used a surface forces apparatus coupled to interference and optical microscopy imaging to study the way two sugar surfaces adhere and detach from adhesive contact. The sugar-coated layers on mica displayed significant loading-unloading hysteresis, and the adhesive strength and failure mechanism during a "loading-unloading cycle" depended on the loading rate, contact time, and unloading rate. The failure of two glassy sugar surfaces was manifested by the nucleation of many sharp microcracks at the external boundary that rapidly propagate along the original contact interface. At the other extreme, when the material is a liquid, "failure" occurs through the nucleation and inward growth of large rounded ripples, characteristic of a Saffman-Taylor fingering instability. In the transition from glassy to viscous failure, sharp crack tips and smooth rounded fingers coexist during the crack propagation. In addition, whereas the detachment geometry of two glassy surfaces was characterized by a peeling-like mechanism along a plane, the fingers associated with the "snapping" of a liquid neck extended in all directions. These findings provide insights into the adhesion and failure mechanisms of materials at the micro/nanoscales and are also relevant to the action of interparticle forces between sugar particles, such as those used in inhalation drug delivery.