Problem : How to Remove or Clear previous entry in InkPicture object MS Access Form
I am new to tablet PC development, but am working on an MS Access application for a client of mine who uses a tablet PC.
I have successfully been able to create an InkPicture field on a form where a signature can be saved to an image file (see code below).
My dilemma is that each time I reopen the form and rerun the form with new data, the signature image that is saved appears to be the previous signature on top of the new signature (the signature that is “displayed” on the form appears correct as when the form initially opens, the signature field is blank).
It looks like I need to find some way to “clear” the contents in this InkPicture object so that it can be “refreshed” prior to a new signature being stored.
I’m hoping to get some specific VBA code because I have found Many articles, but none of which have helped. I believe it may be that I need to use the “dispose” method, but I haven’t found any code that has worked.
‘CODE to SAVE InkPicture to FILE
Dim objInk As MSINKAUTLib.InkPicture
Dim bytArr() As Byte
Dim File1 As String
File1 = “C:\” & TrainerSig & “.gif”
Set objInk = Me.InkPicture2.Object
If objInk.Ink.Strokes.Count > 0 Then
bytArr = objInk.Ink.Save(2)
fSaveFile bytArr, File1
Solution : How to Remove or Clear previous entry in InkPicture object MS Access Form
I have found the solution on my own.
The code was to run the following VBA on the form’s open event: