link image to database code problem

J

Jon

Greeting,

I have the following code for uploading the image path into my table, it is
working fine if the images are store in one folder(main) but that problem now
I have subfolders under the main folder and access could not open the image
because the path is not completed.

Private Sub Command32_Click()


Dim fileName As String

Dim arrFileName() As String

Dim result As Integer

With Application.FileDialog(msoFileDialogFilePicker)


.Title = "Select Item Picture"

.Filters.Add "All Files", "*.*"

.Filters.Add "JPEGs", "*.jpg"

.Filters.Add "Bitmaps", "*.bmp"

.FilterIndex = 2

.AllowMultiSelect = False

.InitialFileName = CurrentProject.Path

result = .Show

If (result <> 0) Then

arrFileName() = Split(.SelectedItems.Item(1), "\", -1)

fileName = "\" + arrFileName(UBound(arrFileName) - 1) + "\" +
arrFileName(UBound(arrFileName)) + "\" + arrFileName(UBound(arrFileName))

Me![Image path].Visible = True

Me![Image path].SetFocus

Me![Image path].Text = fileName
End If

End With
End Sub

I beleve that the problem is one this line because it does not up load the
mainfolder\subfolder\image.bmp.

arrFileName() = Split(.SelectedItems.Item(1), "\", -1)

fileName = "\" + arrFileName(UBound(arrFileName) - 1) + "\" +
arrFileName(UBound(arrFileName)) + "\" + arrFileName(UBound(arrFileName))

any help please??
 
A

a a r o n . k e m p f

Keep your images in SQL Server; and you won't need to worry so much
about the bloat

-Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top