ALBRufino 6/4/2011, 10:35
ai amigo viera
veja o ex:
eu digitalizo o documento ,q ta tudo ok
so que quero salva os arquivo em uma pasta ( criei uma co comndo mdir com o campo pata, pra na hora q digita no campo ela cia com o nome q digitei no campo pasta}
tambem ta tdo ok ex: (sec.educação)e etc cada vez q cria uma pasta ela sala na mesma0
veja como viz
Option Explicit
Private Sub Escaner_Click()
DBPixMain.TWAINAcquire
End Sub
Private Sub Form_Current()
' caminho onde são armazenadas imagens - neste caso o é o caminho do .mdb
Dim Path As String
Path = GetImageFolder
If IsEmpty(Me!Filename) Or IsNull(Me!Filename) Then
DBPixThumb.ImageViewBlob (Null)
DBPixMain.ImageViewBlob (Null)
Else
' Display the thumbnail - the filename is prefixed with 't'
DBPixThumb.ImageViewFile (Path & "t" & Me!Filename)
' Display the main image
DBPixMain.ImageViewFile (Path & Me!Filename)
End If
End Sub
Private Sub DBPixMain_ImageModified()
' A imagem principal foi mudada (eg carregam, cole, gire etc) - exceto mudanças para a pasta de papéis de imagem
Dim ImageFilename As String
Me!Filename = "" ' clear the filename (this also updates the autonumber id if this is a new record)
If DBPixMain.ImageBytes < 1 Then
' Image is empty/cleared/deleted
DBPixThumb.ImageViewBlob (Null) ' Clear the thumbnail control - NOTE: Does not actually delete the main/thumbnail files.
Else
' Get the format from the control's property
If DBPixMain.ImageFormat = 2 Then ' png format
ImageFilename = Me!Id & ".png"
Else ' use jpeg format
ImageFilename = Me!Id & ".jpg"
End If
' Save the image
If DBPixMain.ImageSaveFile(GetImageFolder & ImageFilename) Then
' Store the filename and image-info in the recordset
Me!Filename = ImageFilename
' Update the thumbnail from the main image control then save it
' DBPixThumb.ImageLoadBlob (DBPixMain.Image) ' Copy/Paste is quicker
DBPixMain.ImageCopy
DBPixThumb.ImagePaste
DBPixThumb.ImageSaveFile (GetImageFolder & "t" & ImageFilename)
Else
' Error saving - main image - clear the thumbnail control
DBPixThumb.ImageViewBlob (Null)
End If
End If
End Sub
Private Function GetImageFolder() As String
Dim DBFullPath As String
Dim I As Integer
DBFullPath = CurrentDb().Name
' Strip the filename from the full path
For I = 1 To Len(DBFullPath)
If Mid(DBFullPath, I, 1) = "\" Then
GetImageFolder = Left(DBFullPath, I) & "images\"
' aqui nao consigo 'salva na pasta do campo, so salva na pasta images
End If
Next
End Function
Private Sub Form_Open(Cancel As Integer)
' Update the control size - just call the Resize event handler
Form_Resize
End Sub
Private Sub Form_Resize()
If (InsideWidth - 1000) > 0 Then
DBPixMain.Width = InsideWidth - 1000
End If
If (InsideHeight - 2500) > 0 Then
DBPixMain.Height = InsideHeight - 2500
End If
DBPixMain.ViewZoomToFit
End Sub