DDB example for Access 95 and 97

This example copies the Lead1 bitmap to the clipboard as a DDB. It pastes the DDB into Lead2 and reverses the image. It then gets a DDB from Lead2, sets the same DDB to Lead1, and repaints.

Dim MyFlags, MyDC, MyDDB, MyPalette

DoCmd.Hourglass True
Me![Lead2].Visible = True
Me![Lead1].Visible = True
Lead1.AutoSetRects = False

MyFlags = COPY_EMPTY + COPY_DDB + COPY_PALETTE
Lead1.Copy MyFlags

If Lead2.Paste(PASTE_ISREADY) = 0 Then
    MsgBox ("Invalid data on the clipboard")
Else
    Lead2.Paste 0
End If

Lead2.Reverse

MyDC = Lead2.GetClientDC
MyDDB = Lead2.GetDDB(MyDC)
MyPalette = Lead2.GetPalette(MyDC)

Lead1.SetDDB MyDC, MyDDB, MyPalette
Lead1.ForceRepaint
Lead2.ReleaseClientDC

Me![Lead2].Visible = False
DoCmd.Hourglass False