Results 1 to 3 of 3
  1. #1
    Madmax is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    80

    Need Severe Help-Folder opening/making

    good afternoon,

    I have been messing with this code since this morning and still can not get it to work.

    Code:
    Private Sub Command143_Click()
    On Error GoTo err_Procedure
    Dim pathneeded As String
    pathneeded = "\digitalfiles\" & Me.[Last Name] & "_" & Me.[First Name] & "_" & Me.[ID]"\"
    If Dir(pathneeded, vbDirectory) <> vbNullString Then
    KATALOG = Dir(pathneeded, vbDirectory)
    Shell = ("explorer.eve pathneeded")
    Else
    MkDir "pathneeded"
    Msg = "New Folder Created. please reclick command"
    End If
    err_Procedure:
    Msg = Err.Number & "_" & Err.Description & " " & Err.Source
    MsgBox Msg
    End Sub
    Now this thing sucks to say the least. I have had several problems in creating this and now it looks like crap.

    First,


    on the string Pathneeded. you will see \digitalfiles\. My database is located on a server drive, This drive letter changes depending on who mapped that particular drive. The database is located in a folder called (database) and the folder inside is (digital files). I want this to check and see if a folder based on their [Last name] [First Name] [ID].
    Then,
    If it exists I want it to open that location.
    else
    Make it
    The idea is to see if the folder is there then either make the folder and then open it or open it.
    I pretty sure the whole problem is in the string trying to use the current folder but making a new folder inside of a sub folder in the folder the database resides
    Ideas PLEASE?

  2. #2
    Madmax is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    80
    Okay I did think of something that Might work. is there a way to pull the letter of the current drive that the database is located in set as a varible and then use it in the next varible as the folder's themselves will always be the same?

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I would suggest an alternate way. If everyone has the same server mapped but not necessarily to the same drive letter stay away from using the drive letter. Let's say your server is named File_Server your code would be like this:

    Code:
    pathneeded = "\\file_server\digitalfiles\" & Me.[Last Name] & "_" & Me.[First Name] & "_" & Me.[ID]"\"
    You can get the current database path with this code also:

    Code:
    dim sDBPath as string
    sDBPath = currentproject.path

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Browse For Folder Example
    By pkstormy in forum Code Repository
    Replies: 6
    Last Post: 01-08-2012, 04:13 PM
  2. Importing picture from folder
    By Thejas.s in forum Import/Export Data
    Replies: 0
    Last Post: 04-06-2011, 09:07 AM
  3. Enter a folder name and open that folder
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 09-05-2010, 04:39 PM
  4. Copy file to folder
    By tpcervelo in forum Programming
    Replies: 11
    Last Post: 08-31-2010, 10:01 AM
  5. Creating Viewport into a folder
    By dragondata in forum Access
    Replies: 2
    Last Post: 03-26-2010, 07:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums