Results 1 to 8 of 8
  1. #1
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186

    Modify a location route depending on the information contained into a field

    Hello everyone



    Does somebody know how to modify a location route depending on the information contained into a field?

    Into my form I have a field named "Code_ID" (textbox) and also a buttom named "attachcmd"

    After the event Attachcmd_Onclick I need the attached information will be recorded on this location:


    "C:\Users\General\Desktop\ 'On this part of the path I want to add "Me.Code_ID" \


    How Do I modifiy this part of the code?

    Thanks for all the support!!!

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Like

    "C:\Users\General\Desktop\" & Me.Code_ID
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    Yes, it works pretty good, just a quick question....

    When I using this code a messagebox is shown and the says:

    Run-Time error '70'
    Permission denied
    End Debug.....

    When I click on debug the error is in the red below:


    Dim sourceFolder As String, destinationFolder As String
    Dim aFSO As Object
    Dim Direccion As String
    Dim Destination As String


    Direccion = Me.Problemsupporttxt

    'Me.Problem support is a route pre-selected





    sourceFolder = Direccion


    destinationFolder = "C:\Users\General\Resultado\" & Me.Code_ID


    Set aFSO = CreateObject("Scripting.FileSystemObject")


    aFSO.CopyFile sourceFolder, destinationFolder


    End Sub

    When I delete the "Me.Code_Id" it copies the file but into the location expected

    Thanks for the support

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Do you have appropriate permissions on both source and destination folders? Does the variable resolve to a valid path? You can use this to see the variable values:

    BaldyWeb-Immediate window
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Also, you have this line:
    Code:
    destinationFolder = "C:\Users\General\Resultado\" & Me.Code_ID
    Lets assume that Me.Code_ID = "Trial".

    Then the path looks like "C:\Users\General\Resultado\Trial"

    Does the "Trial" folder exist? If it doesn't, you have to create the directory before you can save anything into it.

  6. #6
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    Yes, this folder exists and it's created before

  7. #7
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    in fact that was the problem on that folder!!!

    I solved just adding

    destinationFolder = "C:\Users\General\Resultado\" & Me.Code_ID + "\"

    and it worked now!!

    Thanks so much for the help!!!

  8. #8
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Glad you got it sorted. I'd use & to concatenate rather than +, which can be used but being a math operator will sometimes produce unexpected results.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 7
    Last Post: 09-19-2014, 03:58 PM
  2. Replies: 8
    Last Post: 05-13-2013, 06:26 PM
  3. Replies: 2
    Last Post: 12-16-2012, 02:48 PM
  4. Replies: 2
    Last Post: 12-14-2012, 04:08 PM
  5. Button to Open HTML contained in Text Field
    By Douglas Post in forum Access
    Replies: 1
    Last Post: 01-22-2012, 12:12 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