?
Solved

Creating a folder select dialog in Access VBA

Posted on 2005-05-11
10
Medium Priority
?
775 Views
Last Modified: 2012-05-05
I simply need to create a "folder selection dialog" in Access XP (2002).  Functionality is more important than looks.

I've tried several approaches but they all seem to mainly use the Application.FileDialog which is if I "get it" is really just calling the common dialog for selecting a "file" not a "folder".  

In this case we would like to just select a "home folder" which could be empty and contain no files.

Optionally, it would ideally also provide for the basic ADD FODLER (folder icon with an asterisk on the corner) to create a folder if they wished.  This exists on the common dialog file picker dialog already.

I apologize for not offering more points but I am new and this was all they provide at first.
0
Comment
Question by:Oolongtea
  • 4
  • 4
  • 2
10 Comments
 
LVL 39

Accepted Solution

by:
stevbe earned 500 total points
ID: 13980345
here is  a link to complete code.

www.mvps.org/access/api/api0002.htm

Steve
0
 
LVL 26

Expert Comment

by:dannywareham
ID: 13980414
Steve's link shoud do all you need (I was gonna post the same link!)

If you just want to be able to browse folders, consider TreeView ActiveX control too.
However, I think the standard dialog should do it all for you, and doesn't over-complicate things..

:-)
0
 
LVL 1

Author Comment

by:Oolongtea
ID: 13980560
Wow you people are fast.  Any suggestions for adding the ideally "also provide for the basic ADD FODLER (folder icon with an asterisk on the corner) to create a folder" part?
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 1

Author Comment

by:Oolongtea
ID: 13980567
FODLER = FOLDER my apologies I am butterfingers
0
 
LVL 39

Expert Comment

by:stevbe
ID: 13980712
Unfortunately that is not part of the standard Windows Folder Browse :-(

Tell to navigate to the folder, if it is not already there, select the folder above it and then give them a button on your form to "Add" folder and you can use MKDir in your code to create the foldwer for them.

You could use the File Dialiog (which does have New Folder functionality) and tell people to select a Default file in that folder (make a dummy file with a nice name like   'Click Here to Select Folder'   they might not realize you are goofing them)

You could use TreeControl and build your own (lots of work)

Steve
0
 
LVL 26

Expert Comment

by:dannywareham
ID: 13984091
I believe that the windows dialog does allow you to add a folder if you right-click in the dialog....
0
 
LVL 39

Expert Comment

by:stevbe
ID: 13986322
< File Dialiog (which does have New Folder functionality) >

seems I already posted that :-)

it is the Folder Browse is the one that does not and Folder browse is what oolongtea is loking for.

Steve
0
 
LVL 1

Author Comment

by:Oolongtea
ID: 13987252
OK lacking a better solution I will probably just go with a dual solution Steves will work for deleting a folder when create new folder is not needed.  

I will likely make single click launch that folder selector and doubleclick launch the alternate file dialog where it will allow users to do both (create folders and choose a file instead of a folder).

If I were a user and had to choose I suppose I'd want both dialogs available.
0
 
LVL 1

Author Comment

by:Oolongtea
ID: 13987258
<<Steves will work for deleting a folder>>
correction make that "deleting" = "selecting"
0
 
LVL 39

Expert Comment

by:stevbe
ID: 13987300
<If I were a user and had to choose I suppose I'd want both dialogs available.>

so would I but it just is not that easy.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question