Results 1 to 2 of 2
Thread: temporary tables (2000)
2005-07-30, 13:47 #1
- Join Date
- Nov 2004
- London, United Kingdom
- 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
2005-07-30, 13:53 #2
- Join Date
- Mar 2002
- Thanked 25 Times in 25 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.