473,396 Members | 1,967 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,396 software developers and data experts.

open folder from access

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 22633
Scott Price
1,384 Expert 1GB
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
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 Expert 1GB
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
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 Expert 1GB
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 Expert 1GB
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
@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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.