Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2007, 02:54 PM
Registered User
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating Microsoft Query

I am using MS office 2000. I use query to import a list of client names and their individual contract numbers from an a billable report which is in a separate excel spreadsheet.
EX:

15 ABC
30 Group
12 Joe Smith Co.

I then take this info and put it into a chart. My problem is that each new week, I create a new billable report worksheet. Currently my query data is coming from 071407 but now I want it to come from 072807 and so on and so forth. How can I change this? (And if so, automatically would be great). Thanks!

 
Old August 1st, 2007, 01:01 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Here is the way

Assuming you have spreadsheet corresponding to the date

Sub Dynamic_Query()

Dim sTabName As String
Dim sXS As String
Dim sQuery As String

sXS = CStr(Format(Date, "mmddyy"))
sTabName = "[" & sXS & "$]"
sQuery = "Select * From " & sTabName & ";" '

End Sub
")

http://www.dotnetdud.blogspot.com
 
Old August 1st, 2007, 09:16 AM
Registered User
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm sorry I don't think I was clear, I meant in a different workbook, not spreadsheet. Will this still work??






Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert SQL to Microsoft Query tgates Excel VBA 0 April 18th, 2008 01:49 PM
Problem updating query sinner Classic ASP Databases 0 January 29th, 2006 02:51 PM
Microsoft Query and Oracle stored procedure shl007 SQL Language 0 October 21st, 2003 02:43 PM
Microsoft Query and Oracle danielwajnberg SQL Language 4 September 17th, 2003 10:55 AM
Microsoft Query and Oracle danielwajnberg Oracle 0 August 28th, 2003 01:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.