John said:
Now I am really lost???????
I am using a text field called [txtPath] to store a file name.
Then I used an “ImageBox†with a control source “=[CurrentProject].[Path] &
[quoted text clipped - 8 lines]
use the OpenSaveFile API to prompt the user for it....
http://www.mvps.org/access/api/api0001.htm
You said:
How can I under program control browse for the file name
that I want to show up in the image box? All files are images with jpg
extension.
So I told you. Basically, you have to use the OpenSaveFile API. There are
examples here:
http://www.mvps.org/access/api/api0001.htm
And another one here that's a little more flexible...
http://www.lebans.com/DownloadFiles/A2KCallBackBrowseVer4.zip
The problem is that you inadvertently asked a question with a complex answer.
And it *requires* that you understand VBA.
I modified the code on his form so that it prompts for JPG files...
Private Sub cmdOpenJPGs_Click()
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "JPG Files (*.JPG)", "*.JPG")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select a graphic file...", _
Flags:=ahtOFN_HIDEREADONLY)
Me.Text1 = strInputFileName
End Sub
you will need to add other filters if you want PNG files or GIF files, for
example...
Private Sub cmdPromptForImageFiles_Click()
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "JPG Files (*.JPG)", "*.JPG")
' I added these later...
strFilter = ahtAddFilterItem(strFilter, "GIF Files (*.GIF)", "*.GIF")
strFilter = ahtAddFilterItem(strFilter, "PNG Files (*.PNG)", "*.PNG")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select a graphic file...", _
Flags:=ahtOFN_HIDEREADONLY)
'assign the returned file to a textbox on my form.
Me.Text1 = strInputFileName
End Sub