RE: Browse window in form.



I to found this to work well but I have two issues that I just can’t seem to
fix.
(1) The text box is set for a hyperlink but when the file path populates the
hyperlink does not work. However if I paste the path into the text box it
works fine.
(2) If I have returned the file path and then search again without selecting
a file. I then press the cancel button the file path already entered into the
text box is deleted.
Is there a way to fix these?
Any help is appreciated.

Nick


"jmonty" wrote:

Go to the webpage: http://www.mvps.org/access/api/api0001.htm
Copy only the shaded area which starts with:
'***************** Code Start **************
and ends with:
'************** Code End *****************
Be sure to include the leading single quotes ['].

Open your Access Database to the Modules tab. Click New.
Paste the code into it.
Change the line Function TestIt() to the following:
Function TestIt() As String
Then change the line:
MsgBox "You selected: " & ahtCommonFileOpenSave(InitialDir:="C:\", _
to
TestIt = ahtCommonFileOpenSave(InitialDir:="C:\", _
Save it.
Open Your form in design mode. Add a button and cancel the wizard. Right
click on the button and select Build Event, then choose Code Builder. In the
newly created sub add the code something similar to:

Private Sub Command2_Click()
Me.Text0 = TestIt()
End Sub

where Command2 is the name for the button and Text0 is the name of your
textbox.
Save all and close the VB window.
Open the form and it should work.
You can play around with the filters and filterindex to customize it a little.
Look at the other code in the module for ideas on how it works.
Good Luck.




--
Thanx in advance!

jmonty


"Jason V" wrote:

I want the user to be able to browse for a file and when chosen, the file
name and path are inserted in an unbound Text box. I have found several
references to the code in the link below but I don't know how to make it work
in my database.

http://www.mvps.org/access/api/api0001.htm
API: Call the standard Windows File Open/Save dialog box

Do I just copy and paste the code into my VBA window? When I do I get an
error, "Only comments may appear after End Sub, End Function, or End
Property".

Thanks

.