Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    petrikos is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    12

    Quote Originally Posted by Minty View Post
    This is a very blinkered response.
    If you aren't willing to invest some time to solve your problem, why should someone else, who is unpaid, invest time in a solution for you??
    Hello,

    For me to be able to write 10 lines of code it will take about 3-4 months to go to a school.
    For someone who knows, it will take about 5 minutes.

    After all, I am asking for help.
    If helping someone costs, then I am very sorry. I am used to help others when I can. And I don't request payments.

    How much do 5 mins of writing code cost for you? If it's reasonable, I will pay. No problem.

  2. #17
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    What does Me.[AA] contain?
    EDIT - Should have also asked if the root folder exists or not. I can't see why you would try to create

    "c:\data files\praktor"

    and then

    MkDir strFolderPath

    I don't think you've clarified what the problem with your code is. At least I'm not getting it.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #18
    petrikos is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    12
    Quote Originally Posted by Micron View Post
    What does Me.[AA] contain?
    EDIT - Should have also asked if the root folder exists or not. I can't see why you would try to create

    "c:\data files\praktor"

    and then

    MkDir strFolderPath

    I don't think you've clarified what the problem with your code is. At least I'm not getting it.
    Hello,

    please read my previous posts.

    The Me.[AA] contains the value of the first field of the form.

  4. #19
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Well, that wasn't real helpful. I can't see exactly what that is from here.
    There were at least 2 other points I questioned that you could have covered rather than telling me to read what I've already read.
    I'd rather bow out than work like a dentist to extract information.
    Good luck with your issue.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #20
    petrikos is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    12
    Quote Originally Posted by Micron View Post
    Well, that wasn't real helpful. I can't see exactly what that is from here.
    There were at least 2 other points I questioned that you could have covered rather than telling me to read what I've already read.
    I'd rather bow out than work like a dentist to extract information.
    Good luck with your issue.
    You are right. But my response is misunderstood.

    I thought that we are loosing focus and that's why I recommended to read my previous posts.

    I already have a button that creates a folder or opens it if it's already created and I posted it's code just to help you understand how it is built. It's code is OK (maybe not perfect but it works).

    I need a button to copy an xls file to the new folder created with the other button or open it if it's already copied in the target folder.
    The name of the folder is taken from the first field value.

    That's what I need and I am sorry if my response didn't sound good.
    Thank you all for responding to my issue.

  6. #21
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Research "ms access vba copy file" and pick one of the sample codes you find. There are tons of them. If they don't include a means of determining whether or not a file already exists and you need that, research that as well. Not trying to be difficult, but code for this has been given out maybe 100K times already and it doesn't make much sense to recreate the wheel, so to speak. Then post code you tried but is not working if that is the result.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #22
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I didn't think I had any old code which is why I posted that. Since I found something I already created I guess I'm not reinventing the wheel so here's an example to get you started. Modified the name of the procedure and the path values for your case. Your project needs a reference to Microsoft Scripting Runtime for this.

    Code:
    Function MyFunctionName()
    Dim fso As Object
    Dim strCopyFrom As String, strCopyTo As String
    
    On Error GoTo errHandler
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    strCopyFrom = "source path here"
    strCopyTo = "target path here"
    fso.CopyFile strCopyFrom, strCopyTo, False 'false = don't over-write. This will generate error 58
    
    
    exitHere:
    On Error Resume Next
    Set fso = Nothing
    Exit Function
    
    errHandler:
    If Err.Number = 58 Then
       MsgBox "File already exists in that location."
    Else
       MsgBox "Error " & Err.Number & ": " & Err.Description
    End If
    
    Resume exitHere
       
    End Function
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #23
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #24
    petrikos is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    12
    Quote Originally Posted by Welshgasman View Post
    I googled about it and I have tried myself but I can't make it work.

    Here is what I have done so far (nothing really)!

    Private Sub copy1file_Click()
    Dim sourcefile As String
    Dim destfolder As String

    sourcefile = "c:\data files\praktor\custinfo.xlsx"
    destfolder = "c:\data files\praktor" & Me.[AA]


    FileSystemObject.CopyFile sourcefile, destfolder

    ' Application.FollowHyperlink "C:\data files\praktor\custinfo.xlsx"





    End Sub

    I tried to open the file and it works, so now I have focused on copying it.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 08-14-2020, 06:55 PM
  2. Workbooks.Open won't open Excel file in Edit Mode
    By jeffhanner10@gmail.com in forum Programming
    Replies: 5
    Last Post: 02-15-2020, 11:51 AM
  3. Replies: 6
    Last Post: 09-14-2017, 07:31 AM
  4. Copy Open db file
    By gg80 in forum Programming
    Replies: 4
    Last Post: 04-24-2013, 04:35 PM
  5. Switchboard button to open txt file
    By Dannat in forum Import/Export Data
    Replies: 17
    Last Post: 01-24-2012, 10:54 AM

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