Bom dia amigos do forum, eu estou utilizando um módulo que foi postado aqui no forum para utilização da webcam para capturar fotos, o que acontece é o sistema só tá aceitando uma foto, eu queria que aceitasse pelo menos três fotos, o código que trabalha essa parte, eu estou colocando aqui em baixo, se alguém puder me dá uma luz onde tenho que mexer, agradeço:
Private Sub CmdCapturaImagem_Click()
On Error GoTo Err_CmdCapturaImagen_Click
capEditCopy lwndC
On Error Resume Next
Dim strCaminnhoPasta As String
strCaminnhoPasta = DLookup("[LocalFoto]", "tblConfig")
Me.OLEPic.SetFocus
DoCmd.RunCommand acCmdPaste
DoCmd.RunCommand acCmdSaveRecord
Dim a() As Byte
Dim b() As Byte
Dim x As Long
Dim lTemp As Long
Dim sl As String
Dim blRet As Boolean
Dim sExt As String
Dim sFileExist As String
' This is an optional param we pass to fGetContentsStream.
' It will contain the original file name of the
' object when embedded as a Package.
Dim PackageFileName As String
Dim iFileHandle As Integer
' Load our Structured Storage Library
' Let's see if the StrStorage.DLL is available.
blRet = LoadLib()
If blRet = False Then
' Cannot find StrStorage.dll file
Exit Sub
End If
lTemp = LenB(Me.OLEPic.Value)
ReDim a(0 To lTemp - 1)
ReDim b(0 To lTemp - 1)
' Copy the contents of the OLE field to our byte array
a = Me.OLEPic.Value
' Make a copy of the original data
b = a
blRet = fGetContentsStream(a(), sExt, PackageFileName)
If blRet = True Then
If sExt = "pak" Then
' If a file was dragged from the Explorer window
' it will have a Package object Filename of NULL
' inserted by Shell.DLL
' Catch and give a temp file name
If Len(PackageFileName & vbNullString) < 3 Then
PackageFileName = "OLE-ExtractDraggedFromExplorer" & "." & "bmp"
End If
iFileHandle = FreeFile
sl = "C:\" & PackageFileName
sFileExist = Dir(sl)
If Len(sFileExist & vbNullString) > 0 Then
Kill sl
End If
Open sl For Binary Access Write As iFileHandle
Put iFileHandle, , a
Close iFileHandle
Else
iFileHandle = FreeFile
sl = "C:\" & sExt & UBound(a) & "." & sExt
sFileExist = Dir(sl)
If Len(sFileExist & vbNullString) > 0 Then
Kill sl
End If
Open sl For Binary Access Write As iFileHandle
Put iFileHandle, , a
'Put iFileHandle, , Me.FotoMembro
Close iFileHandle
End If
Dim StartRegisteredApp As Boolean
'StartRegisteredApp = True
' Do we open the exported OLE object in the
' Application registered for this file type on this system?
If StartRegisteredApp = True Then
' Some apps require vbNullString for the first parameter,
' other apps require "open" for the first parameter
ShellExecuteA Application.hWndAccessApp, vbNullString, sl, vbNullString, vbNullString, 1
End If ' "open"
End If
Dim strCaminho As String, strPastaInicial As String
Dim CopiaSegura As Object
' Faz a cópia do arquivo para a pasta do bd e sub pasta Fotos renomeando para jpg
Set CopiaSegura = CreateObject("Scripting.FileSystemObject")
CopiaSegura.CopyFile sl, strCaminnhoPasta & Me.cxNumeroCadastral.Value & " - " & Me.Nome_Cliente.Value & ".jpg"
Forms.FrmFoto.Foto_Detento = strCaminnhoPasta & Me.cxNumeroCadastral.Value & " - " & Me.Nome_Cliente.Value & ".jpg"
Forms.FrmFoto.img.Picture = Forms.FrmFoto.Foto_Detento
Exit_CmdCapturaImagen_Click:
Exit Sub
Err_CmdCapturaImagen_Click:
MsgBox Err.Description
Resume Exit_CmdCapturaImagen_Click
End Sub
Private Sub CmdCapturaImagem_Click()
On Error GoTo Err_CmdCapturaImagen_Click
capEditCopy lwndC
On Error Resume Next
Dim strCaminnhoPasta As String
strCaminnhoPasta = DLookup("[LocalFoto]", "tblConfig")
Me.OLEPic.SetFocus
DoCmd.RunCommand acCmdPaste
DoCmd.RunCommand acCmdSaveRecord
Dim a() As Byte
Dim b() As Byte
Dim x As Long
Dim lTemp As Long
Dim sl As String
Dim blRet As Boolean
Dim sExt As String
Dim sFileExist As String
' This is an optional param we pass to fGetContentsStream.
' It will contain the original file name of the
' object when embedded as a Package.
Dim PackageFileName As String
Dim iFileHandle As Integer
' Load our Structured Storage Library
' Let's see if the StrStorage.DLL is available.
blRet = LoadLib()
If blRet = False Then
' Cannot find StrStorage.dll file
Exit Sub
End If
lTemp = LenB(Me.OLEPic.Value)
ReDim a(0 To lTemp - 1)
ReDim b(0 To lTemp - 1)
' Copy the contents of the OLE field to our byte array
a = Me.OLEPic.Value
' Make a copy of the original data
b = a
blRet = fGetContentsStream(a(), sExt, PackageFileName)
If blRet = True Then
If sExt = "pak" Then
' If a file was dragged from the Explorer window
' it will have a Package object Filename of NULL
' inserted by Shell.DLL
' Catch and give a temp file name
If Len(PackageFileName & vbNullString) < 3 Then
PackageFileName = "OLE-ExtractDraggedFromExplorer" & "." & "bmp"
End If
iFileHandle = FreeFile
sl = "C:\" & PackageFileName
sFileExist = Dir(sl)
If Len(sFileExist & vbNullString) > 0 Then
Kill sl
End If
Open sl For Binary Access Write As iFileHandle
Put iFileHandle, , a
Close iFileHandle
Else
iFileHandle = FreeFile
sl = "C:\" & sExt & UBound(a) & "." & sExt
sFileExist = Dir(sl)
If Len(sFileExist & vbNullString) > 0 Then
Kill sl
End If
Open sl For Binary Access Write As iFileHandle
Put iFileHandle, , a
'Put iFileHandle, , Me.FotoMembro
Close iFileHandle
End If
Dim StartRegisteredApp As Boolean
'StartRegisteredApp = True
' Do we open the exported OLE object in the
' Application registered for this file type on this system?
If StartRegisteredApp = True Then
' Some apps require vbNullString for the first parameter,
' other apps require "open" for the first parameter
ShellExecuteA Application.hWndAccessApp, vbNullString, sl, vbNullString, vbNullString, 1
End If ' "open"
End If
Dim strCaminho As String, strPastaInicial As String
Dim CopiaSegura As Object
' Faz a cópia do arquivo para a pasta do bd e sub pasta Fotos renomeando para jpg
Set CopiaSegura = CreateObject("Scripting.FileSystemObject")
CopiaSegura.CopyFile sl, strCaminnhoPasta & Me.cxNumeroCadastral.Value & " - " & Me.Nome_Cliente.Value & ".jpg"
Forms.FrmFoto.Foto_Detento = strCaminnhoPasta & Me.cxNumeroCadastral.Value & " - " & Me.Nome_Cliente.Value & ".jpg"
Forms.FrmFoto.img.Picture = Forms.FrmFoto.Foto_Detento
Exit_CmdCapturaImagen_Click:
Exit Sub
Err_CmdCapturaImagen_Click:
MsgBox Err.Description
Resume Exit_CmdCapturaImagen_Click
End Sub