That is quite tricky, & yet you would think it should be very simple. The reason for size increase is because jpg's are stored as bmp's within an access database. Therefore it is much more efficient to store the data externally & creat a table with the path to the file in it...The following code is how we accomplished this. Paired with this, you need a form, containing an object control, a command button & a text field for the path...
Option Compare Database
Option Explicit
Private Sub Form_Current()
On Error GoTo Err_Form_current
Dim S_FILENAME As String
If Not IsNull(Me![A_IMAGE_PATH]) Then
S_FILENAME = Me![A_IMAGE_PATH]
With Me.Imagephoto
.Picture = S_FILENAME
.PictureType = "linked"
End With
RunCommand acCmdSaveRecord
Me.Refresh
End If
If IsNull(Me!A_IMAGE_PATH.Value) Or _
Me!A_IMAGE_PATH.Value = "" Then
'MsgBox "No picture available for this asset"
Me!Imagephoto.Picture = "c:\LandManagement2001\lul\template\norton.jpg"
End If
'DisplayImage Forms![photoselection_waste]![FPhotos_Waste]!
, S_FILENAME
Exit_Form_Current:
Exit Sub
Err_Form_current:
Resume Exit_Form_Current
End Sub
Private Sub OpenBtn_Click()
On Error GoTo Err_OpenFileBtn_Click
Dim S_FILENAME As String
Dim S_INITIALDIR As String
Dim S_COUNTER As Integer
Dim S_POINTER As Integer
S_POINTER = 0
' Step thro the path to determine the directory
If Not IsNull(Me![A_IMAGE_PATH]) Then
For S_COUNTER = 1 To Len(Me![A_IMAGE_PATH]) Step 1
If InStr(S_COUNTER, Me![A_IMAGE_PATH], "\", 0) = S_COUNTER Then
S_POINTER = S_COUNTER
End If
Next S_COUNTER
S_INITIALDIR = Left(Me![A_IMAGE_PATH], S_POINTER)
End If
' Call the common open file dialog to find a file
S_FILENAME = GetOpenFile(IIf(IsNull(S_INITIALDIR), "C:\", S_INITIALDIR))
' Set the field to the return value
If S_FILENAME <> "" Or Not IsNull(S_FILENAME) Then
Me![A_IMAGE_PATH] = S_FILENAME
With Me.Imagephoto
.Picture = S_FILENAME
.PictureType = "linked"
End With
RunCommand acCmdSaveRecord
Me.Refresh
End If
If IsNull(S_FILENAME) Then
S_FILENAME = ""
End If
'DisplayImage Forms![photoselection_waste]![FPhotos_Waste]!
, S_FILENAME
Exit_OpenFileBtn_Click:
Exit Sub
Err_OpenFileBtn_Click:
Resume Exit_OpenFileBtn_Click
End Sub