+ Reply to Thread
Results 1 to 5 of 5

Monthly change of query source file

  1. #1
    Registered User
    Join Date
    10-10-2016
    Location
    Belgium
    MS-Off Ver
    2019
    Posts
    46

    Monthly change of query source file

    Hello

    I have an external file from which I copy data every month to another existing workbook with a MS query.
    Since the file name changes every month (VM 2017 tem 17 01, VM 2017 tem 17 02, VM 2017 tem 17 03, ...) I have to change the connection of the query every time the file name changes. The parameters remain the same. I can do this manually, but some of my colleagues are lost if they have to do this.

    So it would be nice to have the query updated based on a date that is entered in a cell:
    Cell H1=date entered, i.e. 01/03/2017 (dd/mm/yyyy)
    Query update: based on file 'VM 2047 tem 17 03'

    Is this possible? Any help more than welcome.

    Chris

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Monthly change of query source file

    Hi Chris,

    In Power Query, an Add-In tool for Excel, this exact problem is solved using what you suggest. Read about it at:
    https://social.technet.microsoft.com...rum=powerquery
    http://www.excelguru.ca/blog/2014/11...r-power-query/

    I'm not sure how I'd do the problem using MSQuery without a sample workbook. I believe doing it using VBA is the only other alternative than using the above linked technique.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    10-10-2016
    Location
    Belgium
    MS-Off Ver
    2019
    Posts
    46

    Re: Monthly change of query source file

    Hi Marvin

    The Power Query add-in is not allowed by our IT department, so I have to look out for other solutions .
    I've attached a sample workbook to show you what I would like to accomplish.

    On the source sheet are the original data (in real this is an external file (VM 2017 tem 17 03.xlsx).
    On the result sheet is what I would like to have. I1: date entered. This date should trigger a query or something from the corresponding file based on the month and fill the table.
    The source file has over 400 lines and even this number could change if more customers are added.

    I hope this makes sense.

    Chris
    Attached Files Attached Files

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Monthly change of query source file

    Hi Chris,

    Is there a chance you could use the Excel Hyperlink function and build a path to the monthly files?

    http://www.contextures.com/excelhyperlinkfunction.html

    http://chandoo.org/wp/2011/03/31/excel-hyperlinks/

  5. #5
    Registered User
    Join Date
    10-10-2016
    Location
    Belgium
    MS-Off Ver
    2019
    Posts
    46

    Re: Monthly change of query source file

    Hi Marvin

    When I insert a hyperlink to the external file, I get a clickable link that opens the file. I don't see a way to get the filtered data in this way. Probably my lack of knowledge .

    Chris

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. vba to change query source path
    By ma7amadk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2017, 02:31 PM
  2. Macro to change multiple file names (monthly)
    By awc7 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-16-2014, 08:32 PM
  3. Macro to change value in source file
    By Mysore in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-29-2012, 12:56 AM
  4. Replies: 0
    Last Post: 03-19-2011, 06:29 PM
  5. Replies: 1
    Last Post: 11-01-2009, 05:01 AM
  6. MS Query Data Source Change
    By rasinc in forum Excel General
    Replies: 2
    Last Post: 07-27-2005, 03:05 PM
  7. Excel data query locks source file
    By jim.bahr in forum Excel General
    Replies: 0
    Last Post: 06-10-2005, 12:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1