473,569 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need Dialog to show Folders only

4 New Member
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 2614
MikeTheBike
639 Recognized Expert Contributor
@Coxmg
Hi

I think you need a statment like this before .show

Set fd = Application.Fil eDialog(msoFile DialogFolderPic ker)

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,564 Recognized Expert Moderator MVP
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
66782
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 are the other approaches. please advise. thanks!!
5
4222
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 to a folder then open the folder and pick a file that is then placed in a textbox. Any help please Thanks
4
11617
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 microsoft principles: always show them something ;) First I made up a little status dialog containing a gif image to show a little animation and a...
4
2705
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 decision. private void MainForm_Activated(object sender, EventArgs e) { AuthFrm StartUpfrm = new AuthFrm(); if (StartUpfrm.ShowDialog() ==...
3
2182
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 2005 Visual Basic (A poorly documented language). I am unable to find help for Visual Basic that tells me how to show the Browse Files/Folders...
3
5761
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
5274
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 / dangerous? How can I force shutdown code within the dialog's Form.FormClosed event run? Zytan
2
1704
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 by create date of the file and put in dirs by year and the only data iw ant left in the source dir is this months only and when moving to next month i...
0
1133
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 i.e. Desktop, Program Files and Windows from the hierarchy. For other folders list i can always use database per user. Using file permission i can...
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.