Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    London, United Kingdom
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    temporary tables (2000)

    I am trying to query my access database and import the results into Excel via VBA.

    The table I am querying has clients, the daily contribution that they pay, the date the contribution starts from. Client contributions change over and may change in the middle of a month. I am trying to write a report where the user chooses a month and their exact contributions can be calculated. However, their can be several changes in contributions per month. To get the contributions for a particular month I have a query that selects the maximum date before the end of the month for each client. I then need to join that query to the table that has the data about the contribution amounts.

    My first query (for the month of April) is along the lines of
    select clientID, Max (PeriodStart) from tblClientTransPeriods
    where PeriodStart <#05/01/2005#

    I then want to join the results of that query to the same table to pull out the contribution amounts that I need.
    Can I create a temporary table in memory at run time to create the first query and then join my table to the temp table - this is a thing I used to do a lot in Ingres SQL?
    If not, does anyone have any kind suggestions as to how is best to go about getting my recordset?

    Many thanks in advance

    Amanda

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: temporary tables (2000)

    You don't need to create a temporary table, you can create a query based on tblClientTransPeriods and on the query you describe, joined on PeriodStart vs MaxOfPeriodStart, and add the fields from tblClientTransPeriods you need. You can export this query to Excel, or open a recordset on it and use that.

Posting Permissions

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