Embed Signature Command

  • Thread starter Bayou_Bob via AccessMonster.com
  • Start date
B

Bayou_Bob via AccessMonster.com

I've developed a form and corresponding report using ACCESS 97. There are
several locations on the form that I want to create a "Sign" command button
(one button for each location) to insert an electronic signature. Each user
of the form has been instructed to store a "Signature.png" file at a common
location (C:\Data\Signature.png) on their computer that contains their
signature which was captured using the Note Pad feature on a PDA. The
database will be shared among several users that belong to a common network,
so as each user completes their part of the form, they will insert their
electronic signature.

I need help on how to code the "Sign" command button to embed their signature
in a field that will be visible, stored with each corresponding record and
printable with the report. I've read the concerns about bloating the
database with images, but the "Signature.png" files are very small and I need
to store them with the database.

If possible, I'd also like to include an error trap that would pop up a
message if the "Signature.png" file is missing.



Thanks in advance for all the help,

Bayou Bob
 
A

Aaron Erickson

How about changing your tactics a bit? Even though your png files may be
small, your database will grow extensively as you add more pictures to it.
What you could do instead is store a table, say tblSignature, in the
database backend (since you have several users I'm assuming you have a
common datafile). The table would contain each users WindowsUserName along
with their signature picture. You could even create an upload signature
form or something of that nature. Now rather than storing a picture in each
field you want to be "signed" by them, you could instead just store their
WindowsUserName in that field instead. You can grab a windows user name by
creating a module and inserting this code:
'----------------------------------------------------
Option Explicit
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long

Function WindowsUserName() As String

Dim sBuffer As String * 255

Dim lStringLength As Long
lStringLength = Len(sBuffer)
GetUserName sBuffer, lStringLength
If lStringLength > 0 Then
WindowsUserName = Left$(sBuffer, lStringLength - 1)
End If

End Function
'---------------------------------------------------

Of course this is assuming that your users have distinct WindowsUserNames.

Now on the form or report where you want to show the signature, you simply
just have to use a bound image control referencing the username in
tblSignature. I hope I have given some helpful advice.
 
B

Bayou_Bob via AccessMonster.com

I appreciate your response and patience, I'm an infrequent Access user and
don't always know what's best.

I was able to create a MS Word Form that did what I wanted using the
following code but have not been able to find the equivalent command in
ACCESS 97. The users like the function of the Word form but I need to manage
the records in a database.

Selection.InlineShapes.AddPicture FileName:= _
"C:\Data\signature.png", LinkToFile:=False, SaveWithDocument:= _
True

Any suggestions on the equivalent code to use in my Access database?

Once the reports are processed and closed out, I plan on archiving the
records periodically to avoid having the database from growing out of hand.
I'd still prefer to proceed as I had originally intended, but may come back
to your suggestion if it doesn't work out.

Thanks,
Bayou Bob


Aaron said:
How about changing your tactics a bit? Even though your png files may be
small, your database will grow extensively as you add more pictures to it.
What you could do instead is store a table, say tblSignature, in the
database backend (since you have several users I'm assuming you have a
common datafile). The table would contain each users WindowsUserName along
with their signature picture. You could even create an upload signature
form or something of that nature. Now rather than storing a picture in each
field you want to be "signed" by them, you could instead just store their
WindowsUserName in that field instead. You can grab a windows user name by
creating a module and inserting this code:
'----------------------------------------------------
Option Explicit
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long

Function WindowsUserName() As String

Dim sBuffer As String * 255

Dim lStringLength As Long
lStringLength = Len(sBuffer)
GetUserName sBuffer, lStringLength
If lStringLength > 0 Then
WindowsUserName = Left$(sBuffer, lStringLength - 1)
End If

End Function
'---------------------------------------------------

Of course this is assuming that your users have distinct WindowsUserNames.

Now on the form or report where you want to show the signature, you simply
just have to use a bound image control referencing the username in
tblSignature. I hope I have given some helpful advice.
I've developed a form and corresponding report using ACCESS 97. There are
several locations on the form that I want to create a "Sign" command
[quoted text clipped - 24 lines]
Bayou Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top