[AccessD] Append query question

jeffrey.demulling at usbank.com jeffrey.demulling at usbank.com
Wed May 4 11:09:10 CDT 2005


This is just trying off the top of my head but it might work:

INSERT INTO
[tbl Cum Oil Test]
( [Well Name],
 [Date],
 [Cum Oil] )

SELECT
[tbl Monthly Oil Test].[Well Name],
Max([tbl Monthly Oil Test].Date),
[tbl Cum Oil Test]![Cum Oil]+[tbl Monthly Oil Test]![Prod Oil] AS [New Cum]

FROM
[tbl Monthly Oil Test]
INNER JOIN [tbl Cum Oil Test]
ON [tbl Monthly Oil Test]![Well Name]=[tbl Cum Oil Test]![Well Name];

Jeffrey F. Demulling
Project Manager
U.S. Bank Corporate Trust Services
60 Livingston Avenue
EP-MN-WS3C
St. Paul, MN  55107-2292
Ph: 651-495-3925
Fax: 651-495-8103
email: jeffrey.demulling at usbank.com


                                                                           
             "Kaup, Chester"                                               
             <Chester_Kaup at kin                                             
             dermorgan.com>                                             To 
             Sent by:                  accessd at databaseadvisors.com        
             accessd-bounces at d                                          cc 
             atabaseadvisors.c                                             
             om                                                    Subject 
                                       [AccessD] Append query question     
                                                                           
             05/04/2005 10:50                                              
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
                  "Access                                                  
                Developers                                                 
              discussion and                                               
             problem solving"                                              
             <accessd at database                                             
               advisors.com>                                               
                                                                           
                                                                           




The following append query works fine:



INSERT INTO [tbl Cum Oil Test] ( [Well Name], [Date], [Cum Oil] )

SELECT [tbl Monthly Oil Test].[Well Name], [tbl Monthly Oil Test].Date,
[tbl Cum Oil Test]![Cum Oil]+[tbl Monthly Oil Test]![Prod Oil] AS [New
Cum]

FROM [tbl Monthly Oil Test], [tbl Cum Oil Test]

WHERE ((([tbl Monthly Oil Test]![Well Name])=[tbl Cum Oil Test]![Well
Name]));



However if I change the query as follows it will not run. I get a
message of "You tried to execute a query that does not include the
specified expression 'Well Name' as part of an aggregate function". Is
it not possible to do this in one query?



INSERT INTO [tbl Cum Oil Test] ( [Well Name], [Date], [Cum Oil] )

SELECT [tbl Monthly Oil Test].[Well Name], Max([tbl Monthly Oil
Test].Date), [tbl Cum Oil Test]![Cum Oil]+[tbl Monthly Oil Test]![Prod
Oil] AS [New Cum]

FROM [tbl Monthly Oil Test], [tbl Cum Oil Test]

WHERE ((([tbl Monthly Oil Test]![Well Name])=[tbl Cum Oil Test]![Well
Name]));

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




------------------------------------------------------------------------------
Electronic Privacy Notice. This e-mail, and any attachments, contains information that is, or may be, covered by electronic communications privacy laws, and is also confidential and proprietary in nature. If you are not the intended recipient, please be advised that you are legally prohibited from retaining, using, copying, distributing, or otherwise disclosing this information in any manner. Instead, please reply to the sender that you have received this communication in error, and then immediately delete it. Thank you in advance for your cooperation.
==============================================================================




More information about the AccessD mailing list