473,503 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

open folder from access

68 New Member
I would like to open a folder from command button and I am not having any luck;
Expand|Select|Wrap|Line Numbers
  1. ...
  2.   Dim stdfile as string
  3.   open stdfile "c:\temp"
  4. End sub
and I am getting error because I have nothing after open, as far as I know my code can be all wrong.
Thanks for helping Trevor2007
Mar 12 '08 #1
7 22646
Scott Price
1,384 Recognized Expert Top Contributor
What do you mean: Open?

Are you wanting an Open File dialog box, a Windows Explorer window with the Folder displayed?

Regards,
Scott
Mar 13 '08 #2
Trevor2007
68 New Member
What do you mean: Open?

Are you wanting an Open File dialog box, a Windows Explorer window with the Folder displayed?

Regards,
Scott
I want to open the folder as if someone when to the folder in a dir and opend it, so if someone clicked the command button it would automaticly open the folder, (not windows exlorer view), if this explination doesn't help let me know. thanx
Mar 13 '08 #3
Scott Price
1,384 Recognized Expert Top Contributor
That doesn't really help all that much, sorry :-( There are really only two ways to 'open' a folder. The two I mentioned above...

If you want the person to be able to browse through and open a file contained in that folder then you need the Open File Dialog box.

Otherwise, if you just want them to view the contents of the folder, (which includes unrestricted ability to interact with files, including opening, etc...) then you need to call the Windows Explorer.

Here are instructions for how to implement the File Dialog box control, includes full code that you should need for opening whatever type of file that your users wish.

Regards,
Scott
Mar 13 '08 #4
Trevor2007
68 New Member
That doesn't really help all that much, sorry :-( There are really only two ways to 'open' a folder. The two I mentioned above...

If you want the person to be able to browse through and open a file contained in that folder then you need the Open File Dialog box.

Otherwise, if you just want them to view the contents of the folder, (which includes unrestricted ability to interact with files, including opening, etc...) then you need to call the Windows Explorer.

Here are instructions for how to implement the File Dialog box control, includes full code that you should need for opening whatever type of file that your users wish.

Regards,
Scott
ok, thanks, I have decided to go with the windows explorer to open the folder (since its o a network drive, i figure what hey , they can see there files , as aposed to letting the browse for the dir)
I now have a follow up question, This db reads emails and downloads the attachments to a folder, while commenting at the end of the email what the file(s) are (this is in a private sub), when opening the folder, how can I have only the file(s) download for that email displayed?
the line in the private sub to comment attachment(s) downloaded and location is :
Expand|Select|Wrap|Line Numbers
  1.  Me.Body = Me.Body & vbCrLf & locmsg & savefile & FileName & SeqNum & "." & Extension & vbNewLine
  2.  
Me.[Body] is is textbox that contains the body of the email,
locmsg is just text to precede file location
fileName is the the name of the file
seqNum is the sequential # that is concatinated to the file name
This code is on the form that pulls the email from outlook
the form the end user uses to view this information does not contain this code because they are just pulling it from the DB table.
and help?
Thanx
ps. Im guessing the line to find there files would be somthing like :
Expand|Select|Wrap|Line Numbers
  1.  Len ( FileName&SeqNum) = 1 Then
  2.    .show
  3.  
if you are wondering why the drive change it's simply because the process is the same but end result is for a multi user DB
Mar 14 '08 #5
Scott Price
1,384 Recognized Expert Top Contributor
In the link I gave you, you will find all the instructions you need in order to set up the folder browse dialog box, I strongly suggest using it instead of attempting to run the Windows Explorer, since there is no way to limit the Windows Explorer to the files/paths you are wanting.

In order to limit the opening ability of the users to only those files that are included in their email attachment you will need to slightly modify the code that is provided in the link.

I will give you an example and you can let me know if you need more help after trying this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command2_Click()
  2.  
  3. Const conVerticalOnly As Integer = 2
  4. 'Dim fsoSysObj As FileSystemObject
  5. Dim fd As FileDialog, strFilesSelected As String, blnRetVal As Boolean
  6.  
  7. Set fd = Application.FileDialog(msoFileDialogFilePicker)
  8.  
  9. 'Declare a variable to contain the path, it must be a Variant becase
  10. 'the For ... Each construct requires it
  11. Dim vrtSelectedItem As Variant
  12.  
  13. Restart:
  14.  
  15. With fd
  16.     .AllowMultiSelect = False
  17.     .Title = "Browse Files"
  18.         If .Show = -1 Then
  19.             For Each vrtSelectedItem In .SelectedItems
  20.                 If Left(vrtSelectedItem, 15) <> "D:\Access Code\" Then
  21.                     MsgBox "Please select a valid path."
  22.                     GoTo Restart:
  23.                 End If
  24.             'Now, will only be one since MultiSelect = False
  25.             strFilesSelected = vrtSelectedItem
  26.             blnRetVal = Execute_Program(strFilesSelected, "", "")
  27.             Next vrtSelectedItem
  28.         Else
  29.         'The user pressed Cancel
  30.         End If
  31. End With
  32.  
  33. Set fd = Nothing
  34.  
  35. Me!Text0.ScrollBars = conVerticalOnly
  36. Me!Text0 = strFilesSelected
  37.  
  38. End Sub
This example restricts the users from opening any file that isn't located in a specific path, in this case: D:\Access Code\.

You will need to set a string variable that holds the FileName & SeqNum & "." & Extension information, then test your vrtSelectedItem to make sure it corresponds to the allowed file.

Regards,
Scott
Mar 14 '08 #6
Scott Price
1,384 Recognized Expert Top Contributor
As an aside, thanks for attempting to use the code tags! Instructions on their use:

Select your code text, then simply click on the # icon on the top of this reply window. To reflect the language, you can manually edit the first tag to look like this: [code=vb] for vba, change =sql for SQL, etc. Thanks!

Regards,
Scott
Mar 14 '08 #7
eliza81
1 New Member
@Trevor2007
Following is the code sample used to display the outlook folder dialog using VB.NET
Expand|Select|Wrap|Line Numbers
  1. Dim objOutlook As Object
  2. Dim objOlNamespace As Object
  3. Dim objOlFolder As Object
  4.  
  5. objOutlook = CreateObject("Outlook.Application") ' create outlook application object at the run time
  6. objOlNamespace = objOutlook.GetNamespace("MAPI")
  7. objOlFolder = objContactsNS.PickFolder ' displays the folder dialog
  8.  
Jun 2 '10 #8

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

Similar topics

5
21360
by: Phil Stanton | last post by:
Can anyone let me have the code for opening the open file dialog box and getting either a file or folder name as the output. I suspect it will look like Function GetPathOrFile(InputPath as...
3
3284
by: Lee-Anne Waters via AccessMonster.com | last post by:
Hi, i'm hoping someone would be able to help with this. what i need to do is to be able to open a set folder from a access form. at present i have to go into windows explorer and find the...
4
17451
by: lauren quantrell | last post by:
Is there a way to open the MS Outlook address book using VBA and then be able to do something with the return value? I want users to click an icon to open the Outlook address book then when an...
4
1872
by: dennist685 | last post by:
Can't open my .mdb I was experimenting with opening an access database in IIS. For experimenting, I have an .mdb called HasbaraSample. In this case I copied it to the C:\Inetpub\wwwroot\Access...
0
3195
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want...
2
4461
jaccess
by: jaccess | last post by:
I was wondering if there is a simple way to open a specific folder from an access form button. I have a form that a user can enter a date range and either view or print reports based on the date...
3
1897
by: HowHow | last post by:
I am using window XP, office 2000. Found out from internet that I can secure my folders in server if I zip and put a password to it. I did. However, when I try to open my Access from that Zip folder,...
25
2854
by: Andy_Khosravi | last post by:
I just recently changed my database that I'm running from a monolithic DB to a split FE/BE. The front end resides on the client machine and the BE resides on a network drive. I'm experimenting with...
8
4668
by: Arno R | last post by:
Hi all. When I need to search for pictures, I always have too choose thumbnail-view manually. Is it possible to open the common dialog in thumbnail-view programmatically? Example ?? At the...
5
7923
by: Chuck Anderson | last post by:
I run Apache 2.0.55, and Php (both 4.4.1 and 5.2.5) on my home PC (Windows XP). One of the scripts that I run daily needs to access a secure URL (https://..............). When I am running Php4,...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
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,...
0
7342
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...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4680
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...
0
3171
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...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
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 ...
1
741
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.