tedmillerx
Programmer
I'm using the Northwind method of adding pictures to my database. Problem is that navigating gets really unstable when the user tries to add a jpg image that's more than 600k, even though I'm linking (not embedding).
It really doesn't need jpgs larger than about 200k to do the job. Is there a way to limit images to 200k or less? Ideally, when the user selects a file too large, a message box would pop up saying, "Please use images smaller than 200k."
Here's the function for the Add Image button I designed, in case that helps:
Sub getFileName()
' Displays the Office File Open dialog to choose a file name
' for the current record. If the user selects a file
' display it in the image control.
Dim fileName As String
Dim result As Integer
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "Bitmaps", "*.bmp"
.Filters.Add "JPEGs", "*.jpg"
.Filters.Add "TIFFs", "*.tif"
.FilterIndex = 3
.AllowMultiSelect = False
.InitialFileName = CurrentProject.Path
result = .Show
If (result <> 0) Then
fileName = Trim(.SelectedItems.Item(1))
Me![ImagePath].Visible = True
Me![ImagePath].SetFocus
Me![ImagePath].Text = fileName
Me![ImagePath].SetFocus
Me![ImagePath].Visible = True
End If
End With
End Sub
It really doesn't need jpgs larger than about 200k to do the job. Is there a way to limit images to 200k or less? Ideally, when the user selects a file too large, a message box would pop up saying, "Please use images smaller than 200k."
Here's the function for the Add Image button I designed, in case that helps:
Sub getFileName()
' Displays the Office File Open dialog to choose a file name
' for the current record. If the user selects a file
' display it in the image control.
Dim fileName As String
Dim result As Integer
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "Bitmaps", "*.bmp"
.Filters.Add "JPEGs", "*.jpg"
.Filters.Add "TIFFs", "*.tif"
.FilterIndex = 3
.AllowMultiSelect = False
.InitialFileName = CurrentProject.Path
result = .Show
If (result <> 0) Then
fileName = Trim(.SelectedItems.Item(1))
Me![ImagePath].Visible = True
Me![ImagePath].SetFocus
Me![ImagePath].Text = fileName
Me![ImagePath].SetFocus
Me![ImagePath].Visible = True
End If
End With
End Sub