A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Forms SQL Query Question



 
 
Thread Tools Display Modes
  #1  
Old April 18th, 2008, 10:38 PM posted to microsoft.public.access.forms
gator
external usenet poster
 
Posts: 166
Default Forms SQL Query Question

I have a form that displays in tabular form a table. The form footer
contains a textbox that sums the 'amount' field. I want to add another
textbox that displays the sum of the 'amount' of a query of records where
another field is queried.

For example. =SUM(Amount) WHERE City LIKE 'B%'

I can't get this to work....is there something i'm doing wrong?

Many Thx
--
Gator

--
Gator
  #2  
Old April 19th, 2008, 12:40 AM posted to microsoft.public.access.forms
Bob Quintal
external usenet poster
 
Posts: 939
Default Forms SQL Query Question

=?Utf-8?B?R2F0b3I=?= wrote in
:

I have a form that displays in tabular form a table. The form
footer contains a textbox that sums the 'amount' field. I want to
add another textbox that displays the sum of the 'amount' of a
query of records where another field is queried.

For example. =SUM(Amount) WHERE City LIKE 'B%'

I can't get this to work....is there something i'm doing wrong?

Many Thx


You can only use the sum() function in a totals query or on all the
records in the form. If you need to obtain a filtered version of a
sum, use the dSum() function unstead. It accepts 3 parameters,
the field to sum, the name of the table or query which contains the
field, and the Where clause less the WQhere keyword.
= dsum("amount","queryName","City like 'B*'")

Note that the % wildcard is used in some SQL dialects, in others,
including Access, the equivalent is the *


--
Bob Quintal

PA is y I've altered my email address.
** Posted from http://www.teranews.com **
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:08 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.