buat module dulu bos, ini source modulnya :
' YUDI SUSANTO
' [email protected]

Public con As New ADODB.Connection
Private Declare Function GetTempFileName Lib "Kernel32" Alias 
"GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, 
ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Private Declare Function GetTempPath Lib "Kernel32" Alias "GetTempPathA" (ByVal 
nBufferLength As Long, ByVal lpBuffer As String) As Long
Public Const MAX_PATH = 260
Public Const BLOCK_SIZE = 10000

Sub Main()
con.Open "mbs"
'Form1.Show
End Sub

Public Sub FillPhoto(rstMain As Recordset, PFName As String, SizeField As 
String, picEmp As Image)
On Error GoTo Handler
Dim bytes() As Byte
Dim file_name As String
Dim file_num As Integer
Dim file_length As Long
Dim num_blocks As Long
Dim left_over As Long
Dim block_num As Long
Dim hgt As Single


    Screen.MousePointer = vbHourglass
    DoEvents


    file_name = TemporaryFileName()


    file_num = FreeFile
    Open file_name For Binary As #file_num


    file_length = rstMain(SizeField)
    num_blocks = file_length / BLOCK_SIZE
    left_over = file_length Mod BLOCK_SIZE

    For block_num = 1 To num_blocks
        bytes() = rstMain(PFName).GetChunk(BLOCK_SIZE)
        Put #file_num, , bytes()
    Next block_num

    If left_over > 0 Then
        bytes() = rstMain(PFName).GetChunk(left_over)
        Put #file_num, , bytes()
    End If

    Close #file_num

    picEmp.picture = LoadPicture(file_name)
 
    Screen.MousePointer = vbDefault
Exit Sub

Handler:
'    Debug.Print Err.Description
    Resume Next
End Sub

Public Sub GetPhoto(filename As String, rstMain As Recordset, FieldName As 
String, SizeField As String)
'On Error GoTo Handler
Dim file_num As String
Dim file_length As Long
Dim bytes() As Byte
Dim num_blocks As Long
Dim left_over As Long
Dim block_num As Long

    file_num = FreeFile
    Open filename For Binary Access Read As #file_num

    file_length = LOF(file_num)
    If file_length > 0 Then
        num_blocks = file_length / BLOCK_SIZE
        left_over = file_length Mod BLOCK_SIZE

        rstMain(SizeField) = file_length

        ReDim bytes(BLOCK_SIZE)
        For block_num = 1 To num_blocks
            Get #file_num, , bytes()
            rstMain(FieldName).AppendChunk bytes()
        Next block_num

        If left_over > 0 Then
            ReDim bytes(left_over)
            Get #file_num, , bytes()
            rstMain(FieldName).AppendChunk bytes()
        End If

        'rstEmployee.Update
        Close #file_num
    End If
Exit Sub

'Handler:
 '   MsgBox Err.Description
  
 '  Debug.Print Err.Description

End Sub

Public Function TemporaryFileName() As String
Dim temp_path As String
Dim temp_file As String
Dim length As Long

    ' Get the temporary file path.
    temp_path = VBA.Space$(MAX_PATH)
    length = GetTempPath(MAX_PATH, temp_path)
    temp_path = Left$(temp_path, length)

    ' Get the file name.
    temp_file = VBA.Space$(MAX_PATH)
    GetTempFileName temp_path, "per", 0, temp_file
    TemporaryFileName = Left$(temp_file, InStr(temp_file, VBA.Chr$(0)) - 1)
End Function

Public Function AppPath() As String
    
    Dim sAns As String
    sAns = App.Path
    If Right(App.Path, 1) <> "\" Then sAns = sAns & "\"
    AppPath = sAns

End Function

trus ini list simpan fotonya :
With rsLocal
    .AddNew
    !PicId = .RecordCount
    GetPhoto File1.Path & "\" & File1.List(File1.ListIndex), rsLocal, "Pic", 
"PicSize"
    .Update
poto = !PicId
End With
ini cara nampilinnya :
photo = !PicId
rsLocal.Open "Select * From Pictures Where PicId = " & photo, con2, 
adOpenDynamic, adLockOptimistic
FillPhoto rsLocal, "Pic", "PicSize", Image1
rsLocal.Close
jangan lupa bos, sesuaikan variabel nya dengan database yang anda miliki, moga 
membantu

 REGARDS, 


YUDI SUSANTO


      Buat sendiri desain eksklusif Messenger Pingbox Anda sekarang! Membuat 
tempat chat pribadi di blog Anda sekarang sangatlah mudah. 
http://id.messenger.yahoo.com/pingbox/

[Non-text portions of this message have been removed]

Kirim email ke