I have an application that allows an end user to store a file path and associate the external file (i.e. .pdf, .docx, etc) with a specific entry in my Access 2010 database. For example, they may have listed a specific purchase in my database and have a receipt. They scan the receipt and use my interface to select the scan file. My database then makes a copy of this file and saves it in a pre-determined location and stores the path in a data table. In the future, if the user looks up this entry, they can select a button which opens the scanned file so they can view the actual receipt. This all works great. Here's my problem...
Each user may want to store their scans in a different location, either on their local hard drive, or a network location. I would like to give them the ability to select a "default location" for storage of scanned images. I have a small form set up that has two text boxes. First one shows the current default location. Second one is where they can enter a new default location. I have a button on the form called "Choose" for "Choose Location...", and I have the following code associated with that button:
Private Sub Choose_Click()
' Displays the Office File Open dialog to choose a file name
' for PIC1. If the user selects a file
' display it in the image control.
Dim sMyDocs As String
Dim strStartDir As String
Dim strFilter As String
Dim lngFlags As Long
Dim sFile As String
sFile = ""
'Start the file browser from the desired directory
Set oShell = CreateObject("WScript.Shell")
sMyDocs = oShell.SpecialFolders("MyDocuments")
strStartDir = sMyDocs
strStartDir = Left(strStartDir, Len(strStartDir))
strFilter = ahtAddFilterItem(strFilter, "Word", "*.doc")
strFilter = ahtAddFilterItem(strFilter, "PDFs", "*.pdf")
strFilter = ahtAddFilterItem(strFilter, "Excel", "*.xls")
strFilter = ahtAddFilterItem(strFilter, "All Files", "*.*")
sFile = ahtCommonFileOpenSave(InitialDir:=strStartDir, OpenFile:=False, Filter:=strFilter, FilterIndex:=4, Flags:=lngFlags, DialogTitle:="Select Folder")
Me.Form1.Text = sFile
If (IsNull(Me.Form1) = True) Then
Problem is, the selector won't let them stop at a folder. It is waiting for them to select a specific file.
Is there any way I can use the file selector, or something like it, that will accept entry of only a path, without a specific file at the end of it?