File Browse Window Walk through

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Could someone walk me through exactly what to do with the following link that
creates a browse for file window? I know it's what I need to use from
reading several similar questions in this newsgroup, but I'm at a loss of
exactly where to put it, how to code my button on the Access form, etc.

I'm working on a form that will allow the user to browse to a file and then
give me the full path.

That well-known link is: http://www.mvps.org/access/api/api0001.htm

Sorry for being so elementary.

thanks.

Jerry
 
Open a new module in Access.

Copy everything between Code Start and Code End on that page into the new
module (remember that you can select the page, copy it to the clipboard
using Ctrl-C and paste it into Access using Ctrl-V)

Save the module, making sure not to name it the same as any of the routines
in the module. (I normally name my module something like mdlFileDialog)

In the Click event of your button, put code similar to the 4 line example at
the top of the page:

Dim strFilter As String
Dim strInputFileName as string

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

Here, strInputFileName will contain the full path to the file selected. Do
whatever you want with it.
 
Well, I'm getting closer, Doug. I had already copied the text into a module
(modFileBrowse) so I added the 4 lines to the onClick event for the button.
But I get this error: Procedure declaration does not match description of
event or procedure having the same name.

guess I'm still pretty new to working with modules...

Jerry
 
In my troubleshooting I tried the routine in a fresh form and it worked. I
think I'm up and running now.

Thanks.

Jerry
 
Back
Top