473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Need Dialog to show Folders only

4
Here is the code, ACCESS 2007:

Hello, I have a dialog box that opens on a form that lets the user browse files. I simply want to limit it to Folders, how can I do that? Need ASAP. Thanks. ACCESS 2007.

Here is my code, how do I prevent it from showing files? I want Folders only.
Expand|Select|Wrap|Line Numbers
  1.    'Declare a variable as a FileDialog object.
  2.     Dim fd As FileDialog
  3.  
  4.     'Declare a variable to contain the path
  5.     'of each selected item. Even though the path is aString,
  6.     'the variable must be a Variant because For Each...Next
  7.     'routines only work with Variants and Objects.
  8.     Dim vrtSelectedItem As Variant
  9.  
  10.     'Use a With...End With block to reference the FileDialog object.
  11.     With fd
  12.  
  13.         'Use the Show method to display the File Picker dialog box and return the user's action.
  14.         'The user pressed the button.
  15.         If .Show = -1 Then
  16.  
  17.             'Step through each string in the FileDialogSelectedItems collection.
  18.             For Each vrtSelectedItem In .SelectedItems
  19.  
  20.                 'You can use any file I/O functions that you want to work with this path.
  21.                 'This example displays the path in a message box.
  22.                 MsgBox "The path is: " & vrtSelectedItem
  23.  
  24.             Next vrtSelectedItem
  25.         'The user pressed Cancel.
  26.         Else
  27.         End If
  28.     End With
  29.  
  30.     'Set the object variable to Nothing.
  31.     Set fd = Nothing
Oct 14 '09 #1
2 2604
MikeTheBike
639 Expert 512MB
@Coxmg
Hi

I think you need a statment like this before .show

Set fd = Application.FileDialog(msoFileDialogFolderPicker)

In fact I done know how you get away without a Set statement (or have you omitted it?).

??

MTB
Oct 15 '09 #2
NeoPa
32,556 Expert Mod 16PB
Please take the time to research the problem before you post your question. The experts here are more than willing to help you with a specific problem but you have to do your part to learn the basics and also formulate a specific question we can help with. Please take the time to read over the Posting Guidelines, specifically the section on Before you Post your Question.

Before posting any question you are expected to attempt to find and work on a solution. When you find a specific problem with your attempt, that is the time to post here requesting assistance with any difficulties you have or about a particular function of the code that you don't know how to achieve. When posting your problem, details of the problem itself and where it's found are the bare minimum information required. The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you.
Oct 15 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what...
5
by: DD | last post by:
I have been on VBnet and used the Browse for Folders Dialog code, i have two problems 1.Access keeps telling me that the Unload Me is an unknown. 2. What i really want is to open the dialog go...
4
by: Alexander | last post by:
Hi, I have written a program that takes on some operations much more time than I expected. As I have seen users clicking wildly on the screen to make something happen, I want to follow the...
4
by: ronenk | last post by:
I have this code to load an authentication form once my app is loaded. I want the authentication form to be closed if a user is authenticated successfully and to give the option to close app on his...
3
by: William Foster | last post by:
Good evening all, Microsoft is really starting to annoy me as a new user. I am trying to convert my code from VBA (A very user friendly laguage with generally good help files) to Visual Studio...
3
by: Maxwell2006 | last post by:
Hi, I am using Visual Studio 2005. I have added a DLL into GAC. I can confirm that by going to C:\WINDOWS\assembly and see the assembly name.
11
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok /...
2
by: jonathan184 | last post by:
Hi basically what i want this script to do is In a particular dir there are alot of files from today back to 1999 or earlier. So I am trying to have the script search this dir and sort the files...
0
by: miztaken | last post by:
Hi Everyone, Is it possible to customize.net's default File Open/Save Dialog Box to display only selected folders in PC according to user's privilege. I want to totally hide the Special Folders...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.