My Assistant
![]() ![]() |
|
|
Apr 5 2012, 08:31 AM
Post
#1
|
|
|
UtterAccess Member Posts: 38 |
I'm trying to make it so when the user clicks a button on a form it opens up the browser folder dialog box. I've found a website that gives an example using "BrowseFolder". I get an error when attempting to use their example that says "Sub or Function not defined". Is there a reference in Access that I need to enable first to make this work? Or is there something else I'm missing?
Here's the example I'm copying: http://www.ammara.com/access_image_faq/bro...der_dialog.html |
|
|
|
Apr 5 2012, 08:36 AM
Post
#2
|
|
|
UtterAccess Ruler Posts: 1,334 From: Kampala,Uganda The Pearl of Africa |
Hello
There is a link in the article about down loading the code. Have down loaded it? Ronald |
|
|
|
Apr 5 2012, 08:39 AM
Post
#3
|
|
|
UtterAccess VIP / UA Clown Posts: 25,199 From: LI, NY |
If you are using the FileDialog property, you need to include a reference to the Office xx Object Library
|
|
|
|
Apr 5 2012, 08:42 AM
Post
#4
|
|
|
UtterAccess Addict Posts: 253 From: Austin TX |
Here is a code snippet I've used. It opens the Windows FileDialog, saves the file name to a control named txtFileName, and then opens the file:
Dim fDialog As Office.FileDialog Set fDialog = Application.FileDialog(msoFileDialogFilePicker) ' Set up the File Dialog. ' With fDialog .AllowMultiSelect = False ' Do not allow user to make multiple selections in dialog box ' .Title = "Please select a file" ' Set the title of the dialog box. ' .Filters.Clear ' Clear out the current filters, and add our own.' .Filters.Add "All Files", "*.*" ' Show the dialog box. If the .Show method returns True, the user picked at least one file. ' If the .Show method returns False, the user clicked Cancel. ' If .Show Then For Each varFile In .SelectedItems 'Loop through each file selected Me.txtFileName = varFile Application.FollowHyperlink varFile Next ' Else ' MsgBox "You clicked Cancel in the file dialog box." End If End With Set fDialog = Nothing |
|
|
|
Apr 5 2012, 08:42 AM
Post
#5
|
|
|
UtterAccess Addict Posts: 115 |
in your link, you also need to have the code under Usage, linked by Download Code: http://www.ammara.com/access_image_faq/cod...folder_code.txt
this code also needs to be in your DB. |
|
|
|
Apr 5 2012, 08:47 AM
Post
#6
|
|
|
UtterAccess Member Posts: 38 |
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 01:10 AM |