none
Save ink signature from form to table RRS feed

  • Question

  • Hello, I have been working on a database in Access 2013. I would like to create a form where my clients can sign a form using a Surface Pro, their signature should then be saved to the underlying table which could then be printed out via a report. I have done some extensive research and have gotten close but have yet to find what I am looking for. Below are the closest links I have found. Can these be used for Access or is it strictly for Microsoft SQL? If so how would I implement them? If not, Could someone point me in the right direction?

    https://msdn.microsoft.com/en-us/library/ms812495.aspx

    https://msdn.microsoft.com/en-us/library/aa480678.aspx

    Thursday, August 13, 2015 6:03 PM

Answers

  • Hi Valdezmg323,

    >> I would like to create a form where my clients can sign a form using a Surface Pro, their signature should then be saved to the underlying table which could then be printed out via a report.

    I am afraid that you could not use a Surface Pro. For signing in a form and print it, you could try as below:

    1. Create a table with InkData file, set its type as OLE Object
    2. In the Form, add two buttons, one InkPicture and one ImageBox
    3. With the button event, add the code below:

    Private Sub SaveInk1_Click()
        Dim objInk As MSINKAUTLib.InkPicture
        Dim bytArr() As Byte
        Const cFileLoc = "C:\Users\v-tazho\Desktop\TestSig.gif"  'this location will by dynamic in final code based on work order #
            Set objInk = Me.ActiveXCtl1.Object
        If objInk.Ink.Strokes.Count > 0 Then
            bytArr = objInk.Ink.Save(2)
            ImageSaveFile bytArr, cFileLoc
        End If
    End Sub
    Private Function ImageSaveFile(bytArr() As Byte, strFileName As String)
        Dim objStream As Object 'ADODB.Stream
        Set objStream = CreateObject("ADODB.Stream")
        With objStream
            .Type = 1 'adTypeBinary
            .Open
            .Write bytArr
            .SaveToFile strFileName, 2 'adSaveCreateOverWrite
        End With
       ' Me.signature = bytArr  'savinng to binary image to database to try to retrieve later
        'Me.signature2 = strFileName 'Saving name of local image file to database
        Set objStream = Nothing
     End Function
    
    Private Sub ShowImage_Click()
    Me.Image12.Picture = "C:\Users\v-tazho\Desktop\TestSig.gif"
    End Sub
    

    For your requirement, you could save the file to a common path, store the path in the database, and then load the path to the image.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, August 17, 2015 12:12 PM

All replies

  • Hello, I have been working on a database in Access 2013. I would like to create a form where my clients can sign a form using a Surface Pro, their signature should then be saved to the underlying table which could then be printed out via a report. I have done some extensive research and have gotten close but have yet to find what I am looking for. Below are the closest links I have found. Can these be used for Access or is it strictly for Microsoft SQL? If so how would I implement them? If not, Could someone point me in the right direction?

    https://msdn.microsoft.com/en-us/library/ms812495.aspx

    https://msdn.microsoft.com/en-us/library/aa480678.aspx

    Thursday, August 13, 2015 3:19 AM
  • Hi Valdezmg323,

    >> I would like to create a form where my clients can sign a form using a Surface Pro, their signature should then be saved to the underlying table which could then be printed out via a report.

    I am afraid that you could not use a Surface Pro. For signing in a form and print it, you could try as below:

    1. Create a table with InkData file, set its type as OLE Object
    2. In the Form, add two buttons, one InkPicture and one ImageBox
    3. With the button event, add the code below:

    Private Sub SaveInk1_Click()
        Dim objInk As MSINKAUTLib.InkPicture
        Dim bytArr() As Byte
        Const cFileLoc = "C:\Users\v-tazho\Desktop\TestSig.gif"  'this location will by dynamic in final code based on work order #
            Set objInk = Me.ActiveXCtl1.Object
        If objInk.Ink.Strokes.Count > 0 Then
            bytArr = objInk.Ink.Save(2)
            ImageSaveFile bytArr, cFileLoc
        End If
    End Sub
    Private Function ImageSaveFile(bytArr() As Byte, strFileName As String)
        Dim objStream As Object 'ADODB.Stream
        Set objStream = CreateObject("ADODB.Stream")
        With objStream
            .Type = 1 'adTypeBinary
            .Open
            .Write bytArr
            .SaveToFile strFileName, 2 'adSaveCreateOverWrite
        End With
       ' Me.signature = bytArr  'savinng to binary image to database to try to retrieve later
        'Me.signature2 = strFileName 'Saving name of local image file to database
        Set objStream = Nothing
     End Function
    
    Private Sub ShowImage_Click()
    Me.Image12.Picture = "C:\Users\v-tazho\Desktop\TestSig.gif"
    End Sub
    

    For your requirement, you could save the file to a common path, store the path in the database, and then load the path to the image.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, August 17, 2015 12:12 PM
  • I'm trying to do the same thing.  I've used the code above uncommenting out the following statement
    Me.signature = bytArr  'savinng to binary image to database to try to retrieve later
    This appears to work because when I look in the table for that field it indicates that it holds long binary data, but how do I then display that data on a report?  I would prefer not saving the signatures to files because that is not as secure as storing it in the table field.

    For the benefit of others, please mark posts as answered or helpful when they answer or assist you in finding the answer. ___ "We came all this way to explore the Moon, and the most important thing is that we discovered the Earth." - Bill Anders, Apollo 8.

    Sunday, November 22, 2015 8:30 PM